Created
June 2, 2012 09:05
-
-
Save rentalcustard/2857452 to your computer and use it in GitHub Desktop.
Constant resolution in instance_eval
This file contains hidden or 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 A | |
B = Module.new | |
def ieval(&block) | |
instance_eval(&block) | |
end | |
end | |
B = Module.new | |
p A.new.ieval { B } |
This file contains hidden or 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
Ξ ~ → rvm use 1.8.7 | |
Using /Users/tomstuart/.rvm/gems/ruby-1.8.7-p358 | |
Ξ ~ → ruby test2.rb | |
B | |
Ξ ~ → rvm use 1.9.2 | |
Using /Users/tomstuart/.rvm/gems/ruby-1.9.2-p290 | |
Ξ ~ → ruby test2.rb | |
A::B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1.9.3 behaves as 1.8.7 did.