Skip to content

Instantly share code, notes, and snippets.

@ajm188
Created October 24, 2015 13:42
Show Gist options
  • Save ajm188/f34e147b42611c5f3d90 to your computer and use it in GitHub Desktop.
Save ajm188/f34e147b42611c5f3d90 to your computer and use it in GitHub Desktop.
Don't let your hashes return nil, raise errors instead!
class BetterHash < Hash
def initialize(*args)
super { |_, _| raise KeyError }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment