From: ts Date: 2000-08-07T14:54:51+02:00 Subject: [ruby-talk:04328] Re: TABWTDI and Hash.new([]) >>>>> "H" == Hugh Sasse Staff Elec Eng writes: H> I agree with those sentiments as well. I wonder if this would be worth H> extending more gnerally, so user-created classes can use it? Something like this ? pigeon% cat b.rb #!/usr/bin/ruby class A def initialize @a = [] @obj = if iterator? Proc.new else nil end end def add(*args) @a += if @obj && args.size == 0 @obj.call else args end end end a = A.new {[1, 2] + 1} a.add p a a.add [12, 24] p a pigeon% b.rb #> #> pigeon% Guy Decoux