Giter VIP home page Giter VIP logo

ruby-intro-to-hashes-lab-001's Introduction

Intro to Hashes Lab

Objectives

So far we've covered:

  • What hashes are and why we use them
  • How to build simple hashes
  • How to build nested hashes
  • How to access and change data in a hash
  • How to add data to a hash

This lab will help you to practice all of those new skills.

Instructions

  1. Fork and clone this lab and run the test suite to get started. Pay attention to the test suite for this lab. The instructions and comments are designe to help you get the tests to pass.
  2. The test requires you to createa a method, #new_hash, that creates and returns a brand new, empty hash.
  3. The second test requires you to build a method, #actor, that creates and returns a hash with a certain actor's name. read the spec/test output from running rspec or learn this is where you will find the necessary information for passing the test!
  4. The next series of tests will require you to build methods that build up a nested hash, one layer/level at a time, very similarly to how we built our epic_tragedy hash in the previous lesson. Read the test output very carefully, that will guide you through building the necessary methods. At the end of the exercice your multidimentional monopoly hash should look like this:
monopoly =  {
  :railroads=>
  {
    :pieces=>4,
    "rent_in_dollars"=>
    {
      :one_piece_owned=>25,
      :two_pieces_owned=>50,
      :three_pieces_owned=>100,
      :four_pieces_owned=>200
    },
    :names=>
    {
      :reading_railroad=>
      {
        "mortgage_value"=>"$100"
      },
      :pennsylvania_railroad=>
      {
        "mortgage_value"=>"$200"
      },
      :b_and_o_railroad=>
      {
        "mortgage_value"=>"$400"
      },
      :shortline=>
      {
        "mortgage_value"=>"$800"
      }
    }
  }
}

Don't Forget!

Remember to use binding.pry to help you get inside your methods and understand what is going on if you need to debug. Remember to google questions that you have if you get stuck and remember to ask questions on Learn!

Resources

  1. What is a Hash in Ruby?
  2. Ruby Documentation on Hashes

ruby-intro-to-hashes-lab-001's People

Contributors

sophiedebenedetto avatar msuzoagu avatar ahimmelstoss avatar aviflombaum avatar fs-lms-test-bot avatar fislabstest avatar

Watchers

James Cloos avatar Mat Balez avatar Kaitlin Vignali avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.