種類
- インスタンスメソッド (300)
- 関数 (36)
- 文書 (30)
- クラス (12)
ライブラリ
- ビルトイン (312)
クラス
- Method (12)
- Module (108)
- Object (36)
- UnboundMethod (144)
キーワード
- == (12)
-
NEWS for Ruby 2
. 7 . 0 (6) - UnboundMethod (12)
- arity (12)
- bind (12)
-
bind
_ call (12) - clone (12)
-
define
_ method (24) - eql? (12)
- inspect (12)
-
instance
_ methods (12) - method (12)
-
method
_ added (12) - name (12)
-
original
_ name (12) - owner (12)
- parameters (12)
-
private
_ instance _ methods (12) -
protected
_ instance _ methods (12) -
public
_ instance _ method (12) -
public
_ instance _ methods (12) -
public
_ method (12) -
rb
_ class _ instance _ methods (12) -
rb
_ class _ private _ instance _ methods (12) -
rb
_ class _ protected _ instance _ methods (12) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 4 feature (12) -
singleton
_ method (12) -
source
_ location (12) -
to
_ s (12)
検索結果
先頭5件
-
Module
# instance _ method(name) -> UnboundMethod (18131.0) -
self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
...#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
# public _ instance _ method(name) -> UnboundMethod (6119.0) -
self の public インスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
...として与えると発生します。
//emlist[例][ruby]{
Kernel.public_instance_method(:object_id) #=> #<UnboundMethod: Kernel#object_id>
Kernel.public_instance_method(:p) # method `p' for module `Kernel' is private (NameError)
//}
@see Module#instance_method,Object#public_method... -
Module
# instance _ methods(inherited _ too = true) -> [Symbol] (6100.0) -
そのモジュールで定義されている public および protected メソッド名 の一覧を配列で返します。
...end
end
# あるクラスのインスタンスメソッドの一覧を得る
p Foo.instance_methods(false)
p Foo.public_instance_methods(false)
p Foo.private_instance_methods(false)
p Foo.protected_instance_methods(false)
class Bar < Foo
end
//}
実行結果
[:protected_foo, :public_foo]......ar.instance_methods(true) - Object.instance_methods(true)
p Bar.public_instance_methods(true) - Object.public_instance_methods(true)
p Bar.private_instance_methods(true) - Object.private_instance_methods(true)
p Bar.protected_instance_methods(true) - Object.protected_instance_methods(... -
Module
# private _ instance _ methods(inherited _ too = true) -> [Symbol] (6100.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] (6100.0) -
そのモジュールで定義されている protected メソッド名 の一覧を配列で返します。
...そのモジュールで定義されている protected メソッド名
の一覧を配列で返します。
@param inherited_too false を指定するとそのモジュールで定義されているメソッドのみ返します。
@see Object#protected_methods, Module#instance_methods... -
Module
# public _ instance _ methods(inherited _ too = true) -> [Symbol] (6100.0) -
そのモジュールで定義されている public メソッド名 の一覧を配列で返します。
...そのモジュールで定義されている public メソッド名
の一覧を配列で返します。
@param inherited_too false を指定するとそのモジュールで定義されているメソッドのみ返します。
@see Object#public_methods, Module#instance_methods... -
VALUE rb
_ class _ instance _ methods(int argc , VALUE *argv , VALUE mod) (6100.0) -
Module#instance_methods の実体。 モジュール mod に定義されている public メソッド名の リストを文字列の配列で返します。
...Module#instance_methods の実体。
モジュール mod に定義されている public メソッド名の
リストを文字列の配列で返します。... -
VALUE rb
_ class _ private _ instance _ methods(int argc , VALUE *argv , VALUE mod) (6100.0) -
Module#private_instance_methods の実体。 モジュール mod に定義されている private メソッド名の リストを文字列の配列で返します。
...Module#private_instance_methods の実体。
モジュール mod に定義されている private メソッド名の
リストを文字列の配列で返します。... -
VALUE rb
_ class _ protected _ instance _ methods(int argc , VALUE *argv , VALUE mod) (6100.0) -
Module#protected_instance_methods の実体。 モジュール mod に定義されている protected メソッド名の リストを文字列の配列で返します。
...Module#protected_instance_methods の実体。
モジュール mod に定義されている protected メソッド名の
リストを文字列の配列で返します。...