From: Angel Martin Date: 2004-04-29T10:00:23+09:00 Subject: Re: alias or alias_method problem El jue, 29-04-2004 a las 02:29, Kristof Bastiaensen escribi�: > On Thu, 29 Apr 2004 08:36:03 +0900, Angel Martin wrote: > > > alias_method "_[]=","[]=" > > alias_method "_[]" ,"[]" > Try the following instead: > > class Hash #hash[] === hash[nil] > alias_method "old_bracket_assign", "[]=" > alias_method "old_bracket" ,"[]" > def []=(*ag) > value=ag.pop > return old_bracket_assign(nil, value) if ag.size<1 > old_bracket_assign(*(ag.push(value))) > end > def [](*ag) > return old_bracket(nil) if ag.size<1 > old_bracket(*ag) > end > end No work :-(, raise a SyntaxError in the last line of the file: ./ghost.rb:2:in `require': ./manplug.rb:191: syntax error (SyntaxError) from ./ghost.rb:2 My Hash code is about line 125. I don't understand why it protest with a SyntaxError :-? Thanks for reply. Regards, Angel