2008/5/8 Rick DeNatale <rick.denatale / gmail.com>:
> We seem to have lost track of what the OP was trying to do,
>
> class MyArray < Array
>  alias original_add <<
>  def <<(n,k)
>   original_add "#{n}: #{k}"
>  end
> end
>
> He wants
>
> [1,2,3].whatever_the_heck_he_decides_to_call_it(4,5) #=>  [1,2,3, "4:5"]

There is always the option to work with an intermediary:

irb(main):001:0> class MyArray < Array
irb(main):002:1>   ArrayAppender = Struct.new :array, :name do
irb(main):003:2*     def <<(value)
irb(main):004:3>       array.push "#{name}: #{value}"
irb(main):005:3>     end
irb(main):006:2>   end
irb(main):007:1>   def <<(name)
irb(main):008:2>     ArrayAppender.new self, name
irb(main):009:2>   end
irb(main):010:1> end
=> nil
irb(main):011:0> a = MyArray.new
=> []
irb(main):012:0> a << 4 << 5
=> ["4: 5"]
irb(main):013:0>

Kind regards

robert

-- 
use.inject do |as, often| as.you_can - without end