Skip to content

Instantly share code, notes, and snippets.

@edgar
Last active November 10, 2015 22:51
Show Gist options
  • Save edgar/47609d90eae634e63b49 to your computer and use it in GitHub Desktop.
Save edgar/47609d90eae634e63b49 to your computer and use it in GitHub Desktop.
class HashSubclass < Hash
def foo
self.reject {|k,v| k[:foo]}
end
end
obj = HashSubclass.new
new_obj = obj.foo
new_obj.class
# In ruby 1.9.3
=> HashSubclass
# In Ruby 2.2+
=> Hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment