Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An object that intercepts `method_messing` so that it appears you can call class
class CSharpStyle
def method_missing method_name, *args
self.class.send(method_name, *args)
end
def self.static_method
puts "hurray for Ruby"
end
def instance_method
print "here goes nothin! "
static_method
end
end
instance = CSharpStyle.new
instance.instance_method
instance.static_method
# Output
# here goes nothin! hurray for Ruby
# hurray for Ruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment