Method
RubyのMethodクラスは、メソッドのクラスです。
Methodオブジェクトは、メソッドだけではなくそのレシーバも特定していることに注意。
class String def rubyco puts "#{self}" end end "Hello!".rubyco #=> Hello! "Good!".rubyco #=> Good! m = "Nice!".method(:rubyco) p m #=> #<Method: String#rubyco> p m.arity #=> 0 m.call #=> Nice!
Method#arityは引数の数を表します。詳しくは、ri Method#arity を参照。