Skip to content

Instantly share code, notes, and snippets.

@hukl
Created June 30, 2010 20:34
Show Gist options
  • Save hukl/459185 to your computer and use it in GitHub Desktop.
Save hukl/459185 to your computer and use it in GitHub Desktop.
class CrazyHash < Hash
def initialize init_hash
super.merge! init_hash
end
def to_s
"do something different and important so the literal {} wont work"
end
end
f = CrazyHash.new( :b => "C" )
puts f.inspect
=> {:b=>"C"}
@hukl
Copy link
Author

hukl commented Jul 8, 2010

Uhm yeah - rubyists use hashes for named arguments all the time but in this gist it is not the point ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment