Skip to content

Instantly share code, notes, and snippets.

@Zkuns
Created April 7, 2015 06:51
Show Gist options
  • Save Zkuns/16aa21e453adda939384 to your computer and use it in GitHub Desktop.
Save Zkuns/16aa21e453adda939384 to your computer and use it in GitHub Desktop.
test method_missing method
class Awesome
def initialize
@attr = {}
end
def attr
@attr.to_s
end
def method_missing name, *arg
name = name.to_s
if name =~ /=/
@attr[name.chop] = arg[0]
else
@attr[name]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment