From: Ryan Davis Date: 2010-12-30T14:46:13+09:00 Subject: Re: What am I missing about splat operator? On Dec 29, 2010, at 05:21 , Josh Cheek wrote: > a = Object.new > > def a.to_ary > [1, 2] > end > > b , c = a > > b # => 1 > c # => 2 > > > Yes, it works. But I am confused where to_ary came from. I have never used > it myself, and wouldn't have even thought to use it except I saw it in the > sexp. to_ary and to_str are implicit cast methods. to_a (deprecated for Array()) and to_s are (usually) explicit cast methods. to_ary/str are used internally when something is used in an array or string context and you're saying that the object is array-like or string-like. Most things aren't array-like tho, so you don't see the method much.