On Sun, Dec 9, 2012 at 7:24 PM, Marc Heiler wrote:
> Who uses .push when .<< is so much nicer.
That lies in the eye of the beholder, doesn't it? A typical use case
is when you want to append several values which are not stored in an
Enumerable. Using << can become quite lengthy because " << " t
>
>
> irb(main):013:0> ["foo"].push(*"abc".chars)
> => ["foo", "a", "b", "c"]
>
>
A bit beside the point though. I was wondering if #concat should be able to
handle an Enumerator.
But I didn't know push could take more than one argument, so that's
something learned today. Thanks!
-- You r
On Thu, Dec 6, 2012 at 10:43 AM, Intransition wrote:
> Shouldn't this work?
>
> [].concat("abc".chars)
>
> Seems extraneous that one would have to do:
>
> [].concat("abc".chars.to_a)
Then do
irb(main):013:0> ["foo"].push(*"abc".chars)
=> ["foo", "a", "b", "c"]
Cheers
robert
--
remember.gu