Ruby/Reflection/instance eval
Материал из Wiki.crossplatform.ru
Версия от 17:57, 13 сентября 2010; ViGOur (Обсуждение | вклад)
use instance_eval to execute code within the scope of an object:
class MyClass def initialize @my_variable = "Hello, world!" end end obj = MyClass.new obj.instance_eval { puts @my_variable }