Hash API Reference
Ruby's Hash — a dictionary mapping unique keys to values, preserving insertion order.
Hash
A Hash maps each of its unique keys to a specific value, preserving insertion order since Ruby 1.9.
Hash#store(key, value) -> valueAssociates the given value with the given key. Equivalent to h[key] = value.
Returns: Object
Hash#fetch(key, default=nil) -> valueReturns the value for the given key. If key not found, returns default or raises KeyError.
Returns: Object
Hash#keys -> ArrayReturns a new array populated with the keys from this hash.
Returns: Array
Hash#values -> ArrayReturns a new array populated with the values from this hash.
Returns: Array
Hash#each {|key, value| block} -> HashCalls the block once for each key/value pair, passing key and value as parameters.
Returns: Hash
Hash#size -> IntegerReturns the number of key-value pairs. Alias: length.
Returns: Integer
Hash#delete(key) -> valueDeletes the key-value pair and returns the value. Returns nil if key not found (or yields block).
Returns: Object
Hash#has_key?(key) -> boolReturns true if the given key is present. Aliases: key?, member?, include?.
Returns: Boolean