From: Florian Frank Date: 2006-10-03T05:43:01+09:00 Subject: Re: redefining splat? Brian Mitchell wrote: > On 10/2/06, Florian Frank wrote: >> Jeremy Kemper wrote: >> > You can define to_ary which splat uses. In Ruby 1.9 you can define >> > to_splat >> You mean #to_a? > Well, #to_ary expresses a bit more than just splatability (is this even a word?). It means that the Object is in some way actually an Array, not only that it can be converted into an array if needed. A good example for this is Pathname#to_str. So, you don't have to use the splat operator at all, if you want to print a class that implements #to_ary, e. g.: >> class A;def to_ary;[:foo,:bar];end;end # => nil >> puts A.new foo bar This is different from: >> class B;def to_a;[:foo,:bar];end;end # => nil >> puts *B.new foo bar >> puts B.new # -- Florian Frank