Wednesday, 31 July 2013

instance_eval && class_eval

class Person
end
Person.class_eval do
def say
"malakias"
end
end
me = Person.new
me.say
class Person
end
Person.instance_eval do
def go_for_cofe?
true
end
end
Person.go_for_cofe?

No comments:

Post a Comment