instance method Object#public_method

public_method(name) -> Method[permalink][rdoc][edit]

オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。

[PARAM] name:
メソッド名を Symbol または String で指定します。
[EXCEPTION] NameError:
定義されていないメソッド名や、 protected メソッド名、 private メソッド名を引数として与えると発生します。

1.public_method(:to_int) #=> #<Method: Integer#to_int>
1.public_method(:p)      #   method `p' for class `Integer' is private (NameError)

[SEE_ALSO] Object#method,Object#public_send,Module#public_instance_method