Created
August 5, 2011 16:08
-
-
Save ryanlecompte/1127872 to your computer and use it in GitHub Desktop.
Funky constant lookup change between MRI 1.9.2 vs. 1.9.3
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
# see this blog post for differences between 1.8.7 vs 1.9.1 vs. 1.9.2: http://jfire.posterous.com/constant-lookup-in-ruby | |
module M | |
X = 100 | |
def m1 | |
puts X | |
end | |
end | |
class C | |
extend M | |
def self.m2 | |
puts X | |
end | |
end | |
def C.m3 | |
puts X | |
end | |
C.m1 # works in 1.9.2 and 1.9.3 | |
C.m3 # works in 1.9.2, generates missing constant exception in 1.9.3 | |
C.m2 # generates missing constant exception in 1.9.2 and 1.9.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment