Skip to content

Instantly share code, notes, and snippets.

@ryanlecompte
Created August 5, 2011 16:08
Show Gist options
  • Save ryanlecompte/1127872 to your computer and use it in GitHub Desktop.
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
# 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