Get Familiar with Ruby using EdgeCase’s Ruby Koans

2011.12.04 | Ruby | , , , ,

EdgeCase has published a great walkthrough of the various Ruby language features. They call it Ruby Koans.  The Ruby Koans are a a collection of broken tests.  Each broken test is designed to teach you something about the Ruby language.  Many are fill-in-the-blank, eg:

  def test_every_object_has_different_id
    obj = Object.new
    another_obj = Object.new
    assert_equal __, obj.object_id != another_obj.object_id
  end

To pass this koan/test, you’d replace the “__” with true, because new instances of objects have new object_ids.

I wouldn’t recommend this for people new to programming, but if you’re like me and used Ruby a few years ago but have fallen out of practice, it’s a perfect re-introduction.  If you’re new to Ruby but have a solid background in other languages, this may be of use as well.

  • JD

    Awesome, there’s also a Python Koans: https://github.com/gregmalcolm/python_koans/wiki/