I was running an example from page 176 of IronRuby Unleashed and I got an
unexpected error.
I added a class definition for Human to make the example run.  In MRI 1.9.1
the code works as expected.
Thanks for any insight, and I'm always willing to test patches.

             -Matt Closson-


>C:\Program Files\IronRuby 0.9.5.0\bin\ir -profile -trace test.rb
test.rb:13:in `each_object': each_object only supported for objects of type
Class or Module (RuntimeError)
from test.rb:13

>Exit code: 1

class Human
  def initialize(first_name, last_name)
    @first = first_name
    @last = last_name
  end

  def introduce
    puts "Hi, I'm #...@first} #...@last}"
  end
end

john = Human.new('John', 'Doe')
ObjectSpace.each_object(Human) {|x| x.introduce}

---------------------------------------------------------------------------------------------------------------------------------------------

Results from MRI 1.9.1
Hi, I'm John Doe
>Exit code: 0
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to