Recipe Hash

Readme Homework


Recipe Hash

Most programs have data -- here we talk about 3 ways to store data in a program: the ever-present Hash, the cool-kid Struct, and a regular Class.

Your Assignment

Change our recipe hash into a hash that that describes a Train.

It should have

  • a current city, a number of engines, a number of cars, and a caboose.
  • output the train formatted nicely.
  • Create a passenger Struct that has a name and a train (from above)

Show Notes

Copyright: Jesse Wolgamott, MIT License (See LICENSE)

Recipe Hash

  • Area:

    Databases  
  • Runtime:

    22  
  • Tech:

    Structs, Hashes  
  • Tags:

    Struct Hash  

Most programs have data -- here we talk about 3 ways to store data in a program: the ever-present Hash, the cool-kid Struct, and a regular Class.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

ABOUT RUBY OFF RAILS

Ruby Off Rails is dedicated to accelerating the mastering of Ruby and increasing developer happiness everywhere.

In my software training, I see two distinct sets of programmers: those who know Ruby, and those who haven’t learned it yet. People who learn Ruby have an easier time understanding Rails, gems, and what magic voodoo is going on. And most importantly, they can cast wicked voodoo themselves.