るりまサーチ

最速Rubyリファレンスマニュアル検索!
597件ヒット [301-400件を表示] (0.056秒)

別のキーワード

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

検索結果

<< < ... 2 3 4 5 6 > >>

Module#const_source_location(name, inherited = true) -> [String, Integer] (55.0)

name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。

...します。

@param name Symbol,String で定数の名前を指定します。
@param inherited true を指定するとスーパークラスや include したモジュールで定義された定数が対象にはなります。false を指定した場合 対象にはなりません。
@return ソ...
...返します。

//emlist[例][ruby]{
# test.rb:
class A # line 1
C1 = 1
C2 = 2
end


module M # line 6
C3 = 3
end


class B < A # line 10
include
M
C4 = 4
end


class A # 継続して A を定義する
C2 = 8 # 定数を再定義する
end


p B.const_source_location('C4'...
...# => ["test.rb", 7]
p B.const_source_location('C1') # => ["test.rb", 2]

p B.const_source_location('C3', false) # => nil -- include したモジュールは検索しない

p A.const_source_location('C2') # => ["test.rb", 16] -- 最後に定義された位置を返...

Module#private_instance_methods(inherited_too = true) -> [Symbol] (55.0)

そのモジュールで定義されている private メソッド名 の一覧を配列で返します。

...返します。

@see Object#private_methods, Module#instance_methods

//emlist[例][ruby]{
module Foo
def foo; end
private def bar; end
end


module Bar
include
Foo

def baz; end
private def qux; end
end


Bar.private_instance_methods # => [:qux, :bar]
Bar.private_instance_methods(false) #...

Range#===(obj) -> bool (55.0)

始端と終端の中に obj があるとき、true を返します。 そうでないとき、false を返します。

...いられます。

//emlist[例][ruby]{
p (0...50) === 79 #=> false
p (60...80) === 79 #=> true

case 79
when 0...60 then puts "low"
when 60...80 then puts "medium" # => medium
when 80..100 then puts "high"
end

//}

2.5 以前は、単純に Range#include? メソッドを内部で呼んで...
...emlist[例][ruby]{
require 'date'
p (Date.today - 100...Date.today + 100).include?(DateTime.now) #=> false
p (Date.today - 100...Date.today + 100).cover?(DateTime.now) #=> true
p (Date.today - 100...Date.today + 100) === DateTime.now #=> true
# 2.5 以前は、=== は、include? と同じ...
...く比較できず false を返していました。
//}


@see d:spec/control#case
@see Range#include?, Range#cover?...

UnboundMethod#bind(obj) -> Method (55.0)

self を obj にバインドした Method オブジェクトを生成して返します。

...r objがbindできないオブジェクトである場合に発生します

//emlist[例][ruby]{
# クラスのインスタンスメソッドの UnboundMethod の場合
class Foo
def foo
"foo"
end

end


# UnboundMethod `m' を生成
p m = Foo.instance_method(:foo) # => #<UnboundMethod: Foo#f...
...タンスをレシーバとする Method
class Bar < Foo
end

p m.bind(Bar.new) # => #<Method: Bar(Foo)#foo>


# モジュールのインスタンスメソッドの UnboundMethod の場合
module Foo
def foo
"foo"
end

end


# UnboundMethod `m' を生成
p m = Foo.instance_method(...
...:foo) # => #<UnboundMethod: Foo#foo>

# Foo をインクルードしたクラス Bar のインスタンスをレシーバと
# する Method オブジェクトを生成
class Bar
include
Foo
end

p m.bind(Bar.new) # => #<Method: Bar(Foo)#foo>
//}...
...:foo) # => #<UnboundMethod: Foo#foo>

# Foo をインクルードしたクラス Bar のインスタンスをレシーバと
# する Method オブジェクトを生成
class Bar
include
Foo
end

p m.bind(Bar.new) # => #<Method: Bar(Foo)#foo>
//}

@see UnboundMethod#bind_call...

Module#<(other) -> bool | nil (43.0)

比較演算子。self が other の子孫である場合、 true を返します。 self が other の先祖か同一のクラス/モジュールである場合、false を返します。

...@raise TypeError other がクラスやモジュールではない場合に発生します。

//emlist[例][ruby]{
module Foo
end

class Bar
include
Foo
end

class Baz < Bar
end

class Qux
end

p Bar < Foo # => true
p Baz < Bar # => true
p Baz < Foo # => true
p Baz < Qux # => nil
p Ba...

絞り込み条件を変える

Module#<=>(other) -> Integer | nil (43.0)

self と other の継承関係を比較します。

...なければ
nil を返します。

@param other 比較対象のクラスやモジュール

//emlist[例][ruby]{
module Foo
end

class Bar
include
Foo
end

class Baz < Bar
end

class Qux
end

p Bar <=> Foo # => -1
p Baz <=> Bar # => -1
p Baz <=> Foo # => -1
p Baz <=> Qux # => nil
p Q...

Object#is_a?(mod) -> bool (43.0)

オブジェクトが指定されたクラス mod かそのサブクラスのインスタンスであるとき真を返します。

...ルードしたクラスかそのサブクラス
のインスタンスである場合にも真を返します。
Module#includeだけではなく、Object#extendやModule#prepend
よってサブクラスのインスタンスになる場合も含みます。
上記のいずれでもない場合に...
...am mod クラスやモジュールなど、Moduleかそのサブクラスのインスタンスです。

//emlist[][ruby]{
module M
end

class C < Object
include
M
end

class S < C
end


obj = S.new
p obj.is_a?(S) # true
p obj.is_a?(C) # true
p obj.is_a?(Object) # true
p obj.is_a?(M)...

Object#kind_of?(mod) -> bool (43.0)

オブジェクトが指定されたクラス mod かそのサブクラスのインスタンスであるとき真を返します。

...ルードしたクラスかそのサブクラス
のインスタンスである場合にも真を返します。
Module#includeだけではなく、Object#extendやModule#prepend
よってサブクラスのインスタンスになる場合も含みます。
上記のいずれでもない場合に...
...am mod クラスやモジュールなど、Moduleかそのサブクラスのインスタンスです。

//emlist[][ruby]{
module M
end

class C < Object
include
M
end

class S < C
end


obj = S.new
p obj.is_a?(S) # true
p obj.is_a?(C) # true
p obj.is_a?(Object) # true
p obj.is_a?(M)...

Module#<=(other) -> bool | nil (37.0)

比較演算子。self が other の子孫であるか、self と other が 同一クラスである場合、 true を返します。 self が other の先祖である場合、false を返します。

...ror other がクラスやモジュールではない場合に発生します。

@see Module#<

//emlist[例][ruby]{
module Foo; end
module Bar
include
Foo
end

module Baz
prepend Foo
end


Bar.ancestors # => [Bar, Foo]
Foo <= Bar # => false
Bar <= Foo # => true

Baz.ancestors # => [Foo, Baz]
Foo...

Module#>(other) -> bool | nil (37.0)

比較演算子。 self が other の先祖である場合、true を返します。 self が other の子孫か同一クラスである場合、false を返します。

...][ruby]{
module Awesome; end
module Included
include
Awesome
end

module Prepended
prepend Awesome
end


Include
d.ancestors # => [Included, Awesome]
Awesome > Included # => true
Include
d > Awesome # => false

Prepended.ancestors # => [Awesome, Prepended]
Awesome > Prepended # => true
Prepended > A...

絞り込み条件を変える

<< < ... 2 3 4 5 6 > >>