#297: ObjectSpace.each_object returns Class and Module objects when it shouldn't
--------------------------------+-------------------------------------------
Reporter: n...@… | Owner: lsansone...@…
Type: defect | Status: new
Priority: minor | Milestone: MacRuby 0.5
Component: MacRuby | Keywords:
--------------------------------+-------------------------------------------
Comment(by d...@…):
in 0.5 this is still there, but with Module instances which are returned
as Class instances
{{{
$ macruby -e 'p ObjectSpace.each_object(Class).reject { |o|
o.class.ancestors.include? Class }.map { |o| o.class }.uniq'
[Module]
}}}
more general:
{{{
$ macruby -e 'p(
[Object,Module,Class,String,Array,Hash,Integer,Regexp,Range].map { |c|
ObjectSpace.each_object(c).reject { |o| o.class.ancestors.include? c }.map
{ |o| o.class }.uniq.map { |o| {c => o} } }.select { |a| a.size >
0}.flatten)'
[{Class=>Module}, {NSMutableString=>NSString}, {NSMutableArray=>NSArray}]
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/297#comment:4>
MacRuby <http://macruby.org/>
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel