[MacRuby-devel] [MacRuby] #461: each_object: NoMethodError
MacRuby
ruby-noreply at macosforge.org
Wed Nov 25 18:40:50 PST 2009
#461: each_object: NoMethodError
-------------------------------------+--------------------------------------
Reporter: jordan.breeding@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone:
Component: MacRuby | Keywords:
-------------------------------------+--------------------------------------
This code (from Patrick -- http://gist.github.com/242894):
{{{
module ObjectSpace
def each_instance_of(klass)
each_object do |obj|
yield(obj) if obj.instance_of? klass
end
end
def each_kind_of(klass)
each_object do |obj|
yield(obj) if obj.kind_of? klass
end
end
end
include ObjectSpace
class Foo; end
x, y, z = Foo.new, Foo.new, Foo.new
class Bar; end
a = Bar.new
each_instance_of(Foo) { |x| p x }
}}}
This works in 1.8 and 1.9, but in MacRuby it currently gives this:
{{{
./test.rb:3:in `each_instance_of:': undefined method `each_object' for
main:TopLevel (NoMethodError)
from ./test.rb:21:in `<main>'
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/461>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list