Learn Ruby the Hard Way – Exercise 23 Read Some Code

  1. Go to bitbucket.org, github.com, or gitorious.org with your favorite web browser and search for “ruby.”
  2. Pick a random project and click on it.
    I had to pick Ruby Warrior!
  3. Click on the Source tab and browse through the list of files and directories until you find a .rb file.
    There are many .rb files…I decided to look at this level.rb for Ruby Warrior.
  4. Start at the top and read through the code, taking notes on what you think it does.

    Trying to understand the ruby file...
    Trying to understand the ruby file…

    I copied the code into my text editor and tried to read through it, while adding comments on what I thought was happening… there were definitely a lot of new terms and symbols!

  5. If any symbols or strange words seem to interest you, write them down to research later.
    Module
    class
    attr_reader
    attr_accesor
    :
    @
    File.join
    File.expand_path
    File.basename
    .instanceeval
    .new(self)
    <<
    load
    .generate
    yield
    .epic?
    File.basename
    String.rjust
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s