Skip to content

Instantly share code, notes, and snippets.

@akm
Forked from itabatakafumi/RubyTraning
Created May 14, 2010 06:01
Show Gist options
  • Save akm/400861 to your computer and use it in GitHub Desktop.
Save akm/400861 to your computer and use it in GitHub Desktop.
obj = Object.new
def obj.foo(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
options = {:name=>"A", :no=>1}.update(options)
"#{args.inspect} #{options.inspect}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment