Created
January 23, 2010 16:33
-
-
Save gstark/284673 to your computer and use it in GitHub Desktop.
ImplicitReceiverTest
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
class ImplicitReceiverTest | |
def method_missing(method,*args,&block) | |
if method.to_s == "bar=" | |
puts 'method missing for bar=' | |
else | |
super | |
end | |
end | |
def bar=(barvalue) | |
puts "Calling explicit bar=" | |
end | |
def something | |
# Will this call method missing, or assign | |
# a local variable and why? | |
bar= 'this is a test' | |
# what will this be? | |
puts bar.inspect | |
end | |
end | |
ImplicitReceiverTest.new.something |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment