From: Devin Mullins Date: 2006-01-02T13:14:58+09:00 Subject: Re: Can't change the value of self Wilson Bilkovich wrote: >>>"Destructive" methods must alter self using that self's existing >>>destructive methods. >>> >>> >This is why I can't do: >class Fixnum > def double! > self *= 2 > end >end >..right? Too bad. > > Well, that, and what would "2.double!" do? >Speaking of methods.. is there a way to do: >class Something > def <<(a, b) > # do something with a and b > end >end > >s = Something.new >s << 'a', 'b' >results in a syntax error. > > My guess is you're out of luck, there. But you could change it to take s << ['a','b'] or s << 'a' << 'b'. Devin