Matthew Closson
2010-Mar-15 17:36 UTC
[Ironruby-core] ObjectSpace.each_object unexpected results
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20100315/66399faa/attachment.html>