るりまサーチ

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

別のキーワード

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

検索結果

<< < 1 2 3 >>

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

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

...同士の比較では
nil を返します。

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

@
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 Baz > Qux # => nil

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

Module#constants(inherit = true) -> [Symbol] (26.0)

そのモジュール(またはクラス)で定義されている定数名の配列を返します。

...の順序は保証されません。

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

@
see Module.constants, Kernel.#local_variables,...
...Kernel.#global_variables, Object#instance_variables, Module#class_variables

//emlist[Module.constants と Module#constants の違い][ruby]{
# 出力の簡略化のため起動時の定数一覧を取得して後で差し引く
$clist = Module.constants

class Foo
FOO = 1
end
class Bar
BAR = 1...
...ない
p Module.constants - $clist # => [:BAR, :Bar, :Foo]
class Baz
# Baz は定数を含まない
p constants # => []

# ネストしたクラスでは、外側のクラスで定義した定数は
# 参照可能なので、BAR は、Module.constant...

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

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

...します。

@
param inherited_too false を指定するとそのモジュールで定義されているメソッドのみ返します。

@
see Object#private_methods, Module#instance_methods

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

module
Bar
include
Foo

def...

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

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

...返します。

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

Module#ancestors -> [Class, Module] (20.0)

クラス、モジュールのスーパークラスとインクルードしているモジュール を優先順位順に配列に格納して返します。

...先順位順に配列に格納して返します。

//emlist[例][ruby]{
module
Foo
end
class Bar
include
Foo
end
class Baz < Bar
p ancestors
p included_modules
p superclass
end
# => [Baz, Bar, Foo, Object, Kernel, BasicObject]
# => [Foo, Kernel]
# => Bar
//}

@
see Module#included_modules...

絞り込み条件を変える

<< < 1 2 3 >>