Last active
August 29, 2015 14:17
-
-
Save krasnoukhov/0f69d40909f53657387f to your computer and use it in GitHub Desktop.
INSTANCE EVALER!
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
omg = Class.new do | |
attr_accessor :test1 | |
attr_accessor :test2 | |
def inspect | |
puts "test1", test1.inspect | |
puts "test2", test2.inspect | |
puts "="*40 | |
end | |
end | |
wow = omg.new | |
wow.inspect | |
wow.instance_eval(IO.read("smth.rb")) | |
wow.inspect |
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
test1 | |
nil | |
test2 | |
nil | |
======================================== | |
test1 | |
"wow1" | |
test2 | |
"wow2" | |
======================================== |
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
instance_eval(IO.read("template.rb")) | |
self.test1 = "wow1" |
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
self.test2 = "wow2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment