るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

<< 1 2 3 ... > >>

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

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

...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': index 4 out of matches (IndexError)
//}

@see MatchData#begin...

Range#end -> object (18217.0)

終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま せん。

...終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま
せん。

//emlist[例][ruby]{
(10..20).last # => 20
(10...20).last # => 20
//}

@see Range#begin...

Module#ruby2_keywords(method_name, ...) -> nil (12375.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

... the given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword arguments, t...
...ent is marked with a special
flag such that if it is the final element of a normal argument splat to
another method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed through the meth...
...od to
other methods.

T
his should only be used for methods that delegate keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.

T
his method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby ve...

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

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

...ist[例][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 (12361.0)

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

...ist[例][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_development_dependency(gem, *requirements) -> [Gem::Dependency] (12313.0)

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

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

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

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

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

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

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

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

...この 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...

Object#extend(*modules) -> self (12261.0)

引数で指定したモジュールのインスタンスメソッドを self の特異 メソッドとして追加します。

...ス)に機能を追加します
が、extend は、ある特定のオブジェクトだけにモジュールの機能を追加
したいときに使用します。

引数に複数のモジュールを指定した場合、最後
の引数から逆順に extend を行います。

@param modules モ...
...スは不可)。
@return self を返します。

//emlist[][ruby]{
module Foo
def a
'ok Foo'
end

end


module Bar
def b
'ok Bar'
end

end


obj = Object.new
obj.extend Foo, Bar
p obj.a #=> "ok Foo"
p obj.b #=> "ok Bar"

class Klass
include Foo
extend Bar
end


p Klass.new.a #=> "o...
...//}

extend の機能は、「特異クラスに対する Module#include」
と言い替えることもできます。
ただしその場合、フック用のメソッド
が Module#extended ではなく Module#included になるという違いがあります。

//emlist[][ruby]{
# obj.extend Foo,...

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

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

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

このメソッドを上書きすることで、prepend の処理を変...
...m 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


Recorde...
...r::RECORDS # => [A, C]
//}

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

Module#protected_method_defined?(name, inherit=true) -> bool (12249.0)

インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が protected であるときに true を返します。 そうでなければ false を返します。

...ュールに定義されており、
しかもその可視性が protected であるときに true を返します。
そうでなければ false を返します。

@param name Symbol か String を指定します。
@param inherit 真を指定するとスーパークラスや include したモジ...
...ethod_defined?, Module#public_method_defined?, Module#private_method_defined?

//emlist[例][ruby]{
module A
def method1() end
end

class B
protected
def method2() end
end

class C < B
include A
def method3() end
end


A.method_defined? :method1 #=> true
C.protected_meth...
...od_defined? "method1" #=> false
C.protected_method_defined? "method2" #=> true
C.protected_method_defined? "method2", true #=> true
C.protected_method_defined? "method2", false #=> false
C.method_defined? "method2" #=> true
//}...

絞り込み条件を変える

Symbol#end_with?(*suffixes) -> bool (12244.0)

self の末尾が suffixes のいずれかであるとき true を返します。

...とき true を返します。

(self.to_s.end_with?と同じです。)

@param suffixes パターンを表す文字列 (のリスト)

@see Symbol#start_with?

@see String#end_with?

//emlist[][ruby]{
:hello.end_with?("ello") #=> true

# returns true if one of the +suffixes+ matches....
...:hello.end_with?("heaven", "ello") #=> true
:hello.end_with?("heaven", "paradise") #=> false
//}...
<< 1 2 3 ... > >>