Skip to content

Instantly share code, notes, and snippets.

@skatenerd
Created March 18, 2013 17:22
Show Gist options
  • Save skatenerd/5189009 to your computer and use it in GitHub Desktop.
Save skatenerd/5189009 to your computer and use it in GitHub Desktop.
Wat
class Foo < Hash
def initialize(input_hash)
self.class[input_hash]
end
end
Foo[{h: 22}]
# => {:h=>22}
Foo.new({h: 22})
# => {}
@skatenerd
Copy link
Author

Your way seems to give "undefined method [] for Class Class"

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