ruby-koans

What's the best way to test this?

I'm going through the EdgeCase Ruby Koans. In about_dice_project.rb, there's a test called "test_dice_values_should_change_between_rolls", which is straightforward: def test_dice_values_should_change_between_rolls dice = DiceSet.new dice.roll(5) first_time = dice.values dice.roll(5) second_time = dice.values ...

Is there a Perl equivalent of the ruby koans project?

Is there a Perl equivalent to the ruby-koans project? When I was starting to learn ruby a few months ago I stumbled across ruby-koans and it was a huge help for learning the basics of the language. I now need to poke at some Perl code, and while I've hacked together a few Perl scripts in the past I've never really learned the language,...

Is there a supplementary guide/answer key for ruby koans?

I have recently tried sharping my rails skills with this tool: http://github.com/edgecase/ruby_koans but I am having trouble passing some tests. Also I am not sure if I'm doing some things correctly since the objective is to just pass the test, there are a lot of ways in passing it and I may be doing something that isn't up to standard...

Array slicing in Ruby: looking for explanation for illogical behaviour (taken from Rubykoans.com)

I was going through the exercises at http://rubykoans.com/ and I was struck by the following Ruby quirk that I found really unexplainable: array = [:peanut, :butter, :and, :jelly] array[0] => :peanut #OK! array[0,1] => [:peanut] #OK! array[0,2] => [:peanut, :butter] #OK! array[0,0] => [] #OK! array[2] => :and #OK! array[2,2] ...

stuck on about_methods.rb on the EdgeCase Ruby Koans

I'm hacking my way through the EdgeCase RubyKoans (www.rubykoans.com) and am stuck on the method starting at line 35 in about_methods.rb here. Running rake fails predictably and tells me to look at line 36. I'm reasonable sure I have the assert_match correct ("0 for 2") but I don't know what's failing. It's very possible that the assert_...

Help with Ruby Koans #6 - What exception has been caught?

I'm trying to learn Ruby through Koans but I'm stuck on the 6th step. Here's the code: def test_you_dont_get_null_pointer_errors_when_calling_methods_on_nil # What happens when you call a method that doesn't exist. # The following begin/rescue/end code block captures the exception and # make some assertions about it. ...

Ruby Koan 151 raising exceptions

Hey guys, I'm going through the ruby koans, I'm on 151 and I just hit a brick wall. Here is the koan: # You need to write the triangle method in the file 'triangle.rb' require 'triangle.rb' class AboutTriangleProject2 < EdgeCase::Koan # The first assignment did not talk about how to handle errors. # Let's handle that part now. d...

What's this _n_ Ruby koans?

Hi! I'm trying out Ruby koans and found some tests using this _n_ , never seen it before what is it and how do I use it? Example: def test_objects_have_methods fido = Dog.new assert fido.methods.size > _n_ end // John ...