るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
10件ヒット [1-10件を表示] (0.018秒)
トップページ > クラス:Module[x] > クエリ:include[x] > クエリ:<[x] > バージョン:2.6.0[x]

別のキーワード

  1. _builtin include?
  2. socket mcast_include
  3. set include?
  4. dbm include?
  5. gdbm include?

検索結果

Module#include(*mod) -> self (54523.0)

モジュール mod をインクルードします。

...ます。

@param mod Module のインスタンス( Enumerable など)を指定します。

@raise ArgumentError 継承関係が循環してしまうような include を行った場合に発生します。

//emlist[例][ruby]{
module
M
end
module
M2
include M
end
module
M
include M2
end
//}...
...ールのほうが
先に行われます
(上の例の Module#ancestors の結果がメソッド探索の順序です)。

同じモジュールを二回以上 include すると二回目以降は無視されます。

//emlist[例][ruby]{
module
M
end
class C1
include M
end
class C2 < C1
include...

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

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

...list[例][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#include?(mod) -> bool (18379.0)

self かその親クラス / 親モジュールがモジュール mod を インクルードしていれば true を返します。

...クラス / 親モジュールがモジュール mod を
インクルードしていれば true を返します。

@param mod Module を指定します。

//emlist[例][ruby]{
module
M
end
class C1
include M
end
class C2 < C1
end

p C1.include?(M) # => true
p C2.include?(M) # => true
//}...

Module#<=>(other) -> Integer | nil (18340.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 # =>...

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

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

...クラス

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

絞り込み条件を変える

Module#method_defined?(name, inherit=true) -> bool (58.0)

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

...モジュールで
定義されたメソッドも対象になります。

@see Module#public_method_defined?, Module#private_method_defined?, Module#protected_method_defined?

//emlist[例][ruby]{
module
A
def method1() end
def protected_method1() end
protected :protected_method1
end...

Module#private_method_defined?(name, inherit=true) -> bool (58.0)

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

...したモジュールで
定義されたメソッドも対象になります。

@see Module#method_defined?, Module#public_method_defined?, Module#protected_method_defined?

//emlist[例][ruby]{
module
A
def method1() end
end
class B
private
def method2() end
end
class C < B
includ...

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

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

...したモジュールで
定義されたメソッドも対象になります。

@see Module#method_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
inclu...

Module#public_method_defined?(name, inherit=true) -> bool (58.0)

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

...たモジュールで
定義されたメソッドも対象になります。

@see Module#method_defined?, Module#private_method_defined?, Module#protected_method_defined?

//emlist[例][ruby]{
module
A
def method1() end
end
class B
protected
def method2() end
end
class C < B
includ...

Module#ancestors -> [Class, Module] (40.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...

絞り込み条件を変える