The hash class. See Hash Expressions for more information.
Returns the value mapped to key. If the corresponding key is not registered returns the default value (or nil if not specified).
Maps value to key. Returns value.
Clears the hash contents. Returns self.
Returns a new hash with the same contents as the receiver. Using clone on a frozen hash will return a similarly frozen hash, but dup returns an unfrozen hash with identical contents.
Returns value.
Deletes the mapping from key. Returns the removed value, or nil if there is no value corresponding to key.
Evaluates a block if it is supplied but there are no matches with key and then returns the result.
Evaluates a block with key and value as arguments. Returns self.
Evaluates a block with key as the argument. Returns self.
Evaluates a block with value as the argument. Returns self.
Returns true if the hash is empty.
Returns true if the hash includes key as a key.
Returns true if the hash includes value as a value as determined by ==.
Returns the key corresponding to val. If there is no corresponding element, returns nil.
If there are multiple corresponding keys, arbitrarily returns one of them.
Returns an array of all keys.
Returns the number of elements in the hash.
Returns an array of all values in the hash.