Created
January 21, 2011 21:24
-
-
Save jfirebaugh/790454 to your computer and use it in GitHub Desktop.
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
1.8.7-p330 | |
instance method: Foo::X | |
singleton method: ::X | |
class_eval: ::X | |
instance_eval: ::X |
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
1.9.1-p378 | |
instance method: Foo::X | |
singleton method: ::X | |
class_eval: Foo::X | |
instance_eval: Foo::X | |
1.9.2-p136 | |
instance method: Foo::X | |
singleton method: Foo::X | |
class_eval: ::X | |
instance_eval: Foo::X |
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
puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" | |
X = '::X' | |
class Foo | |
X = 'Foo::X' | |
def foo | |
puts "instance method: #{X}" | |
end | |
end | |
Foo.new.foo | |
f = Foo.new | |
def f.bar | |
puts "singleton method: #{X}" | |
end | |
f.bar | |
Foo.class_eval do | |
puts "class_eval: #{X}" | |
end | |
Foo.new.instance_eval do | |
puts "instance_eval: #{X}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment