るりまサーチ

最速Rubyリファレンスマニュアル検索!
948件ヒット [401-500件を表示] (0.090秒)
トップページ > クエリ:Ruby[x] > クエリ:ruby[x] > 種類:インスタンスメソッド[x] > クエリ:@[x] > クエリ:end[x] > クラス:Module[x]

別のキーワード

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

検索結果

<< < ... 3 4 5 6 7 ... > >>

Module#remove_method(*name) -> self (56.0)

インスタンスメソッド name をモジュールから削除します。

...します。

Ruby
1.8.0 以降は複数のメソッド名を指定して一度に削除できます。

@
param name 0 個以上の String か Symbol を指定します。

@
raise NameError 指定したメソッドが定義されていない場合に発生します。

//emlist[例][ruby]{
class C...
...def foo
end

remove_method :foo
remove_method :no_such_method # 例外 NameError が発生
end

//}

@
see Module#undef_method...

Module#<(other) -> bool | nil (50.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#<=(other) -> bool | nil (50.0)

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

...を返します。

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

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

@
see Module#<

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

module
Baz
prepend Foo
end


Bar.ancestors # =...

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

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

...す。

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

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

@
see Module#<

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

module
Prepended
prepend Awesome
end


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

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

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

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

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

...を返します。

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

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

@
see Module#<

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

module
Baz
prepend Foo
end


Bar.ancestors # =...

絞り込み条件を変える

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

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

...できます。

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

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

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


# Object は i...
...# 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 以外でも同様になった
# 第二引数...

Module#const_get(name, inherit = true) -> object (50.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 O...
...bject
include Bar
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) #...

Module#define_method(name) { ... } -> Symbol (50.0)

インスタンスメソッド name を定義します。

...val されます。

@
param name メソッド名を String または Symbol を指定します。

@
param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。

@
return メソッド名を表す Symbol を返します。

@
raise TypeError me...
...thod に同じクラス、サブクラス、モジュール以外のメソッ
ドを指定した場合に発生します。

//emlist[例][ruby]{
class Foo
def foo() p :foo end
define_method(:bar, instance_method(:foo))
end

Foo.new.bar # => :foo
//}...

Module#define_method(name, method) -> Symbol (50.0)

インスタンスメソッド name を定義します。

...val されます。

@
param name メソッド名を String または Symbol を指定します。

@
param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。

@
return メソッド名を表す Symbol を返します。

@
raise TypeError me...
...thod に同じクラス、サブクラス、モジュール以外のメソッ
ドを指定した場合に発生します。

//emlist[例][ruby]{
class Foo
def foo() p :foo end
define_method(:bar, instance_method(:foo))
end

Foo.new.bar # => :foo
//}...
<< < ... 3 4 5 6 7 ... > >>