Skip to content

Instantly share code, notes, and snippets.

@nickserv
Last active December 20, 2015 11:59
Show Gist options
  • Save nickserv/6127655 to your computer and use it in GitHub Desktop.
Save nickserv/6127655 to your computer and use it in GitHub Desktop.
A simple wrapper class around a Hash in Ruby
class HashWrapper
# Create a new HashWrapper that wraps around a new empty Hash
def initialize
@hash = {}
end
# Get the value of a key
def [](key)
@hash[key]
end
# Set the value of a key
def []=(key, value)
@hash[key] = value
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment