Skip to content

Instantly share code, notes, and snippets.

@gstark
Created January 23, 2010 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gstark/284673 to your computer and use it in GitHub Desktop.
Save gstark/284673 to your computer and use it in GitHub Desktop.
ImplicitReceiverTest
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