Created
March 16, 2011 07:58
-
-
Save zdavatz/872173 to your computer and use it in GitHub Desktop.
persistable.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object # :nodoc: all | |
def odba_id | |
end | |
def odba_instance | |
self | |
end | |
def odba_isolated_stub | |
self | |
end | |
def metaclass; class << self; self; end; end | |
def meta_eval &blk; metaclass.instance_eval &blk; end | |
end |
class Object
def metaclass
class << self
self
end
end
def meta_eval(&blk)
metaclass.instance_eval(&blk)
end
end
class Test
end
test = Test.new
test.meta_eval do
define_method('hello') do
p 'hello'
end
end
test.hello
test2 = Test.new
test2.hello
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
def metaclass
class << self
self
end
end
def meta_eval(&blk)
metaclass.instance_eval(&blk)
end