[Nitro] HasManyCollection : Enumerable ?

itsme213 itsme213 at hotmail.com
Fri Jun 30 21:45:38 EDT 2006


Why does this not implement the Enumerable interface? It does not do #find 
correctly, returning an array instead of the element (or nil).


irb(main):017:0> c = i.slots
=> #<Og::HasManyCollection:0x3f804c0 @members=[], @remove_proc=:remove_slot, 
@loaded=false, @owner=#
<Instance:0x3f93f18 @type_oid=2, @name="n1", @oid=5, 
@slots=#<Og::HasManyCollection:0x3f804c0 ...>,
@errors=#<Glue::Validation::Errors:0x3f88068 @errors={}>>, 
@find_options=nil, @insert_proc=:add_slot
, @count_proc=:count_slots, @member_class=Slot, @building=false, 
@find_proc=:find_slots>


irb(main):018:0> c.find {|s| s.name == "foo"}
=> []

irb(main):019:0> Enumerable === c
=> false


Thanks.





More information about the Nitro-general mailing list