From: furufuru / ccsr.u-tokyo.ac.jp (Ryo Furue)
Subject: [ruby-talk:19517] Why not?: Assigning to self
Date: Sat, 11 Aug 2001 19:43:29 +0900
>       self = res
>    end
> end
> 
> The line "self = res" gives an error
> 
>    smooth:17: Can't change the value of self
>          self = res

You can use "replace(res)" instead of "self = res". 

% ri Array#replace
---------------------------------------------------------- Array#replace
     arr.replace( anOtherArray ) -> arr
------------------------------------------------------------------------
     Replaces the contents of arr with the contents of anOtherArray,
     truncating or expanding if necessary.
        a = [ "a", "b", "c", "d", "e" ]
        a.replace( [ "x", "y", "z" ] )   #=> ["x", "y", "z"]
        a                                #=> ["x", "y", "z"]

%

-- Gotoken