Expand All

Ruby

Goal

To teach you Ruby we are going to explain the basic building blocks used in the Ruby language and allow you reinforce what you've learned through challenges.

When you have completed this curriculum you should understand:

  • The command line and why we use it
  • How to run your Ruby code interactively (irb) or from a file
  • Simple types like numbers, strings, and booleans
  • Data structures like arrays and hashes
  • Object concepts like Classes

Requirements

We're going to be working with:

  • Ruby
  • A command line program
  • A text editor of your choice

Everything should be set up the night before during our Installfest. Please ensure you have everything working before you show up for the workshop.

You can verify that you have everything working by following steps 1 through 4 of the Installfest Completion Checklist, which is copied and pasted below; and trying these steps out in your terminal:

NOTE: When writing a command after the $ sign in your terminal, or in IRB, just press Enter or Return to execute it.

  1. To go to the workspace folder: type cd ~/workspace

  2. To start the virtual machine: type vagrant up

  3. To connect to the virtual machine: type vagrant ssh

  4. To start the Ruby interactive editor, type irb

  5. Now try the following in IRB. The irb(main)> is the prompt and you don't need to type it:

irb(main)> 1 + 2
=> 3
irb(main)> exit

If you can do that, you are probably good to go.

Format

Each lesson will look like this:

Step Title

Goal:

Description of the current step.

Red because big goals are scary.

Steps:

steps to take.
def code_to_write
  1 + 1
end

Yellow because we've gotten it done, but we have no clue what's going on.

Challenges

A list of activities to try to reinforce the concepts learned in the lesson

Orange because it stimulates the brain by increasing its oxygen supply.

Explanation

Details of what the steps actually did. Spell out the cause and effect.

Green because we can tie everything together now.

Next Step: