On Dec 5, 7:13 am, Witold Rugowski <rugow... / nhw.pl> wrote:
> Sergio Gil P=E9rez de la Manga wrote:
>
> > foo *[1,2,3]
>
> > (
> > similar to grouping several arguments into an array if method
> > definition:
>
> > def foo(*args)
> > end
>
> > foo 1, 2, 3
> > )
>
> Thnx a lot ;)
> --
> Posted viahttp://www.ruby-forum.com/.

A note on splat; it can be used to both gather and unpack elements,
depending on the context. For example...

def baz(a, b, c)
 p a, b, c
end
def foo(*bar) # gathering - bar =3D [1, 2, 3]
  baz(*bar)   # unpacking - bar =3D 1, 2, 3
end
foo(1, 2, 3)

Regards,
Jordan