Created
June 30, 2010 20:34
-
-
Save hukl/459185 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 kinda like what Obj-C has.
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
I see, that's neat. Go Ruby!