Posted over 2 years ago. Visible to the public.

Ruby basics

Ruby is the programming language we use almost exclusively.


  • Be able to read and write simple ruby programs.
  • Gain an understanding of the following concepts:
    • Basic datatypes: Strings, Numbers, Booleans, Arrays, Hashes
    • Basic language constructs: if, each, case, break
    • Regular expressions
    • Functions: def, return
    • Object orientation
      • Classes
      • Class methods vs instance methods (def self.method vs. def method)
      • Inheritance
      • Modules and include
    • Code blocks
    • Input and Output
  • Know where to find documentation for ruby's standard library.


Look at these


  • Reference for Ruby standard libraries
  • DevDocs combines multiple API documentations in a fast, organized, and searchable interface


Word count

Write a small ruby programm cw that accepts a filename, counts the number of
words, lines and paragraphs, and outputs the result.


  • Find out about ARGV.
  • Look up File on apidock.
  • Learn about regular expressions.


Give Array a new method .random_each, that loops randomly through the entries.
I want to be able to say

[1, 2, 3, 4, 5].random_each do |value| puts value end

And get

4 2 1 5 3


  • Find out about "class reopening" aka. "monkey patching" (e.g.
  • Find out about yield

Author of this card:

Henning Koch
Last edit:
about 1 month ago
by Florian Leinsinger
Posted by Henning Koch to makandra Curriculum