るりまサーチ

最速Rubyリファレンスマニュアル検索!
708件ヒット [501-600件を表示] (0.090秒)

別のキーワード

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

検索結果

<< < ... 4 5 6 7 8 > >>

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

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

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

継承関係にないクラス同士の比較では
nil を返します。

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

@rai...
...se 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 Baz > Q...
...ux # => nil

p Foo < Object.new # => in `<': compared with non class/module (TypeError)
//}...

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

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

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

self と other を比較して、
self が other の子孫であるとき -1、
同一のクラス/モジュールのとき 0、
self が other の先祖であるとき 1
を返します。

継承関係にないクラス同士の比較では
n...
...ます。

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

Module#const_defined?(name, inherit = true) -> bool (132.0)

モジュールに name で指定される名前の定数が定義されている時真 を返します。

...きます。

@param name String, Symbol で指定される定数名。

@param inherit false を指定するとスーパークラスや include したモジュールで
定義された定数は対象にはなりません。

//emlist[例][ruby]{
module
Kernel
FOO = 1
end


# Object は incl...
...の定数に対しても
# true を返す
p Object.const_defined?(:FOO) # => true

module
Bar
BAR = 1
end

class Object
include Bar
end

# ユーザ定義のモジュールに対しても同様
p Object.const_defined?(:BAR) # => true

class Baz
include Bar
end

# Object 以外でも同様に...
...なった
# 第二引数のデフォルト値が true であるため
p Baz.const_defined?(:BAR) # => true

# 第二引数を false にした場合
p Baz.const_defined?(:BAR, false) # => false
//}...

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

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

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

継承関係にないクラス同士の比較では
nil を返します。

@param other 比較対象のモジ...
...@raise TypeError 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 <= Baz # => false
Baz <= Foo # => true

Foo <= Foo # => true
Foo <= Object # => nil
//}...

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

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

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

継承関係にないクラス同士の比較では
nil を返します。

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

@raise TypeError other...
...ee Module#<

//emlist[例][ruby]{
module
Awesome; end
module
Included
include Awesome
end

module
Prepended
prepend Awesome
end


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

Prepended.ancestors # => [Awesome, Prepended]
Awesome > Prepende...
...d # => true
Prepended > Awesome # => false

Awesome > Awesome # => false
Awesome > Object # => nil
//}...

絞り込み条件を変える

Module#>=(other) -> bool | nil (126.0)

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

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

継承関係にないクラス同士の比較では
nil を返します。

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

@raise TypeError other...
...す。

@see Module#<

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

module
Baz
prepend Foo
end


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

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

Foo >= Foo # => true
Foo >= Objec...

Module#alias_method(new, original) -> Symbol (126.0)

メソッドの別名を定義します。

...メソッドの別名を定義します。

//emlist[例][ruby]{
module
Kernel
alias_method :hoge, :puts # => :hoge
alias_method "foo", :puts # => :foo
end

//}

alias との違いは以下の通りです。

* メソッド名は String または Symbol で指定します
* グローバル...
...ram new 新しいメソッド名。String または Symbol で指定します。

@param original 元のメソッド名。String または Symbol で指定します。

@return 作成したエイリアスのメソッド名を表す Symbol を返します。

@see d:spec/def#alias

//emlist[例][ruby...
...]{
module
Kernel
alias_method :foo, :puts
end


foo "bar" # bar
//}...

Module#alias_method(new, original) -> self (126.0)

メソッドの別名を定義します。

...メソッドの別名を定義します。

//emlist[例][ruby]{
module
Kernel
alias_method :hoge, :puts # => Kernel
end

//}

alias との違いは以下の通りです。

* メソッド名は String または Symbol で指定します
* グローバル変数の別名をつけることはで...
...ram new 新しいメソッド名。String または Symbol で指定します。

@param original 元のメソッド名。String または Symbol で指定します。

@return self を返します。

@see d:spec/def#alias

//emlist[例][ruby]{
module
Kernel
alias_method :foo, :puts
end


foo "bar...
..." # bar
//}...

Module#class_exec(*args) {|*vars| ... } -> object (126.0)

与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。

...与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。

モジュールのコンテキストで評価するとは、実行中そのモジュールが self になるということです。
つまり、そのモジュールの...
...ます。

@param args ブロックに渡す引数を指定します。


//emlist[例][ruby]{
class Thing
end

c = 1

Thing.class_exec{
def hello()
"Hello there!"
end


define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end

}

t = Thing.new...
...p t.hello() #=> "Hello there!"
p t.foo() #=> 1
//}

@see Module#module_eval, Module#class_eval...

Module#const_get(name, inherit = true) -> object (126.0)

name で指定される名前の定数の値を取り出します。

...name で指定される名前の定数の値を取り出します。

Module
#const_defined? と違って Object を特別扱いすることはありません。

@param name 定数名。String か Symbol で指定します。
完全修飾名を指定しなかった場合はモジュー...
...

@param inherit false を指定するとスーパークラスや include したモジュールで
定義された定数は対象にはなりません。

@raise NameError 定数が定義されていないときに発生します。

//emlist[例][ruby]{
module
Bar
BAR = 1
end

class Obje...
...r
end

# Object では include されたモジュールに定義された定数を見付ける
p Object.const_get(:BAR) # => 1

class Baz
include Bar
end

# Object以外でも同様
p Baz.const_get(:BAR) # => 1
# 定義されていない定数
p Baz.const_get(:NOT_DEFINED) #=> raise NameError...

絞り込み条件を変える

<< < ... 4 5 6 7 8 > >>