Ruby/Reflection/instance method
Материал из Wiki.crossplatform.ru
Версия от 17:57, 13 сентября 2010; ViGOur (Обсуждение | вклад)
binding creates a new Method object
unbound_length = String.instance_method(:length) class String def length 99 end end str = "cat" str.length # 99 bound_length = unbound_length.bind(str) bound_length.call # 3