1. Computing

Building Hashes

By , About.com Guide

1 of 5

Building Hashes

A hash is an associative array. Instead of using numerical indexes, any object (but typically symbols) can be used. They can be both a fast way to retrieve an object based on a key, and a convenient key/value store. There's no doubt, hashes are one of the most used types in Ruby.

But how do you build a Hash? How do you insert data into it other than assigning keys to values one at a time? There are a few methods of building hashes you should know about.

  1. About.com
  2. Computing
  3. Ruby
  4. Beginning Ruby
  5. Building Hashes

©2013 About.com. All rights reserved.