るりまサーチ

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

別のキーワード

  1. _builtin each_object
  2. objectspace each_object
  3. object send
  4. object to_enum
  5. json object

検索結果

<< < ... 3 4 5 >>

Module#class_variables(inherit = true) -> [Symbol] (108.0)

クラス/モジュールに定義されているクラス変数の名前の配列を返します。

...d
class Two < One
@@var2 = 2
end
One.class_variables # => [:@@var1]
Two.class_variables # => [:@@var2, :@@var1]
Two.class_variables(false) # => [:@@var2]
//}

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

Module#freeze -> self (108.0)

モジュールを凍結(内容の変更を禁止)します。

...

凍結したモジュールにメソッドの追加など何らかの変更を加えようとした場合に
FrozenError
が発生します。

@see Object#freeze

//emlist[例][ruby]{
module
Foo; end
Foo.freeze

module
Foo
def foo; end
end # => FrozenError: can't modify frozen module
//}...

Module#instance_method(name) -> UnboundMethod (108.0)

self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。

...@see Module#public_instance_method, Object#method

//emlist[例][ruby]{
class Interpreter
def do_a() print "there, "; end
def do_d() print "Hello "; end
def do_e() print "!\n"; end
def do_v() print "Dave"; end
Dispatcher = {
"a" => instance_method(:do_a),
"d" => instance_...
...method(:do_d),
"e" => instance_method(:do_e),
"v" => instance_method(:do_v)
}
def interpret(string)
string.each_char {|b| Dispatcher[b].bind(self).call }
end
end

interpreter = Interpreter.new
interpreter.interpret('dave')
# => Hello there, Dave!
//}...

Module#private_constant(*name) -> self (108.0)

name で指定した定数の可視性を private に変更します。

...を返します。

@see Module#public_constant, Object#untrusted?

//emlist[例][ruby]{
module
Foo
BAR = 'bar'
class Baz; end
QUX = 'qux'
class Quux; end

private_constant :QUX
private_constant :Quux
end

Foo::BAR # => "bar"
Foo::Baz # => Foo::Baz
Foo::QUX # => NameError: private con...
...stant Foo::QUX referenced
Foo::Quux # => NameError: private constant Foo::Quux referenced
//}...

Module#private_instance_methods(inherited_too = true) -> [Symbol] (108.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) # => [:qux]
//...

絞り込み条件を変える

Module#protected_instance_methods(inherited_too = true) -> [Symbol] (108.0)

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

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

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


@see Object#protected_methods, Module#instance_methods...

Module#psych_yaml_as(tag) -> () (108.0)

クラスと tag の間を関連付けます。

...された YAML ドキュメントを Ruby のオブジェクトに
変換したりその逆をしたりすることができます。

この method は deprecated です。 Object.yaml_tag を
かわりに使ってください。

@param tag 対象のクラスに関連付けるタグの文字列...

Module#public_instance_methods(inherited_too = true) -> [Symbol] (108.0)

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

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

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


@see Object#public_methods, Module#instance_methods...

Module#yaml_as(tag) -> () (108.0)

クラスと tag の間を関連付けます。

...された YAML ドキュメントを Ruby のオブジェクトに
変換したりその逆をしたりすることができます。

この method は deprecated です。 Object.yaml_tag を
かわりに使ってください。

@param tag 対象のクラスに関連付けるタグの文字列...
<< < ... 3 4 5 >>