Hash is a collection of unique keys and values in Ruby. Hash is similar to an Array, except that it indexes with arbitrary keys of any object type. The order in which various iterators return keys and their values in Hash is random and will rarely be in the insertion order.
Curly braces are used instead of square brackets in hash literals, and the key value pairs are joined by =>. A hash with a single key/value pair of Bob/84, for example, might look like this: "Bob" equals 84. By separating key/value pairs with commas, further key/value pairs can be added to the hash literal.
You may build an array of hashes by either using array or simply initializing array with hashes. To push hashes inside the array, use push(). In ruby, both "Key" and:Key function as a key in a hash.
Share a personalized message with your friends.