るりまサーチ

最速Rubyリファレンスマニュアル検索!
1599件ヒット [1-100件を表示] (0.079秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

検索結果

<< 1 2 3 ... > >>

MatchData#end(n) -> Integer | nil (24162.0)

n 番目の部分文字列終端のオフセットを返します。

...

@
param n 部分文字列を指定する数値。

@
raise IndexError 範囲外の n を指定した場合に発生します。

//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.end(0) # => 6
p $~.end(1) # => 3
p $~.end(2) # => 6
p $~.end(3) # => nil
p $~.end(4) # => `end': i...
...ndex 4 out of matches (IndexError)
//}

@
see MatchData#begin...

Array#at(nth) -> object | nil (15130.0)

nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。

...nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。

@
param nth インデックスを整数で指定します。
先頭の要素が 0 番目になります。nth の値が負の時には末尾から
のインデックス...
...ドによる
暗黙の型変換を試みます。

@
raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。

//emlist[例][ruby]{
a = [ "a", "b", "c", "d", "e" ]
a[0] #=> "a"
a[1] #=> "b"
a...

Module#prepend_features(mod) -> self (12261.0)

Module#prepend から呼び出されるメソッドで、 prepend の処理の実体です。このメソッド自体は mod で指定した モジュール/クラスの継承チェインの先頭に self を追加します。

...Module#prepend から呼び出されるメソッドで、
prepend の処理の実体です。このメソッド自体は mod で指定した
モジュール/クラスの継承チェインの先頭に self を追加します。

このメソッドを上書きすることで、prepend の処理を変...
...

@
param mod prepend を呼び出したモジュール
@
return mod が返されます

//emlist[例][ruby]{
class Recorder
RECORDS = []
end


module X
def self.prepend_features(mod)
Recorder::RECORDS << mod
end

end


class A
prepend X
end


class B
include X
end


class C
prepend X
end
...
...Recorder::RECORDS # => [A, C]
//}

@
see Module#prepend, Module#prepended...

Module#append_features(module_or_class) -> self (12231.0)

モジュール(あるいはクラス)に self の機能を追加します。

... Ruby で書くと以下のように定義できます。

//emlist[例][ruby]{
def include(*modules)
modules.reverse_each do |mod|
# append_features や included はプライベートメソッドなので
# 直接 mod.append_features(self) などとは書けない
mod.__send__(:append...
..._features, self)
mod.__send__(:included, self)
end

end

//}

@
see Module#included...

MatchData#byteend(n) -> Integer | nil (12155.0)

n 番目の部分文字列終端のバイトオフセットを返します。

...バイトオフセットを返します。

@
param n 部分文字列を指定する数値。
@
param name 名前付きキャプチャを指定する文字列またはシンボル。

@
raise IndexError 範囲外の n を指定した場合に発生します。
@
raise IndexError 正規表現中で定義...
...

//emlist[例][ruby]{
/(c).*(いう).*(e.*)/ =~ 'abcあいうdef'
p $~ # => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.byteend(0) # => 15
p $~.byteend(1) # => 3
p $~.byteend(2) # => 12
p $~.byteend(3) # => 15
p $~.byteend(4) # => index 4 out of matches (IndexError)
//}...
...//emlist[シンボルを指定する例][ruby]{
/(?<key>\S+):\s*(?<value>\S+)/ =~ "name: ruby"
$~ # => #<MatchData "name: ruby" key:"name" value:"ruby">
$~.byteend(:key) # => 4
$~.byteend(:value) # => 10
$~.byteend(:foo) # => undefined group name reference: foo (IndexError)
//}...

絞り込み条件を変える

MatchData#byteend(name) -> Integer | nil (12155.0)

n 番目の部分文字列終端のバイトオフセットを返します。

...バイトオフセットを返します。

@
param n 部分文字列を指定する数値。
@
param name 名前付きキャプチャを指定する文字列またはシンボル。

@
raise IndexError 範囲外の n を指定した場合に発生します。
@
raise IndexError 正規表現中で定義...
...

//emlist[例][ruby]{
/(c).*(いう).*(e.*)/ =~ 'abcあいうdef'
p $~ # => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.byteend(0) # => 15
p $~.byteend(1) # => 3
p $~.byteend(2) # => 12
p $~.byteend(3) # => 15
p $~.byteend(4) # => index 4 out of matches (IndexError)
//}...
...//emlist[シンボルを指定する例][ruby]{
/(?<key>\S+):\s*(?<value>\S+)/ =~ "name: ruby"
$~ # => #<MatchData "name: ruby" key:"name" value:"ruby">
$~.byteend(:key) # => 4
$~.byteend(:value) # => 10
$~.byteend(:foo) # => undefined group name reference: foo (IndexError)
//}...

Gem::Specification#add_dependency(gem, *requirements) -> [Gem::Dependency] (9225.0)

この gem の RUNTIME 依存性を追加します。 実行時に必要となる gem を指定します。

...します。

//emlist[][ruby]{
# https://github.com/rurema/bitclust/blob/v1.2.3/bitclust-core.gemspec#L25
s.add_runtime_dependency "progressbar", ">= 1.9.0", "< 2.0"
//}

@
param gem 依存する gem の名前か Gem::Dependency のインスタンスを指定します。

@
param requirements バー...
...ジョンの必要条件を 0 個以上指定します。デフォルトは ">= 0" です。

@
see Gem::Specification#add_development_dependency, Gem::Dependency...

Gem::Specification#add_development_dependency(gem, *requirements) -> [Gem::Dependency] (9225.0)

この gem の DEVELOPMENT 依存性を追加します。 この gem の開発時に必要となる gem を指定します。

...list[][ruby]{
gem "rack", "~> 1.6", ">= 1.6.12"
//}

@
param gem 依存する gem の名前か Gem::Dependency のインスタンスを指定します。

@
param requirements バージョンの必要条件を 0 個以上指定します。デフォルトは ">= 0" です。

@
see Gem::Specification#ad...
...d_runtime_dependency, Gem::Dependency...

Gem::Specification#add_runtime_dependency(gem, *requirements) -> [Gem::Dependency] (9225.0)

この gem の RUNTIME 依存性を追加します。 実行時に必要となる gem を指定します。

...します。

//emlist[][ruby]{
# https://github.com/rurema/bitclust/blob/v1.2.3/bitclust-core.gemspec#L25
s.add_runtime_dependency "progressbar", ">= 1.9.0", "< 2.0"
//}

@
param gem 依存する gem の名前か Gem::Dependency のインスタンスを指定します。

@
param requirements バー...
...ジョンの必要条件を 0 個以上指定します。デフォルトは ">= 0" です。

@
see Gem::Specification#add_development_dependency, Gem::Dependency...

Rake::InvocationChain#append(task_name) -> Rake::InvocationChain (9225.0)

与えられたタスク名を追加して新しい Rake::InvocationChain を返します。

...スク名を追加して新しい Rake::InvocationChain を返します。

@
param task_name 追加するタスク名を指定します。

@
raise RuntimeError 循環したタスクの呼び出しを検出した場合に発生します。

//emlist[][ruby]{
# Rakefile での記載例とする

task...
...default: :test_rake_app
task :test_rake_app do
invocation_chain= Rake::InvocationChain.new("task_a", Rake::InvocationChain::EMPTY)
invocation_chain.append("task_b") # => LL("task_b", "task_a")
end

//}...

絞り込み条件を変える

Thread::Backtrace::Location#absolute_path -> String (9137.0)

self が表すフレームの絶対パスを返します。

...][ruby]{
# foo.rb
class Foo
at
tr_accessor :locations
def initialize(skip)
@
locations = caller_locations(skip)
end

end


Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end


# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}

@
see Thread::Backtrace::Location#path...
<< 1 2 3 ... > >>