From: Angel Martin Date: 2004-04-29T10:11:42+09:00 Subject: Re: alias or alias_method problem > > 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 :-? because I forget to change some code in the file :-) Ok, works great but when i tried: return _[]=(nil, value) if ag.size<1 it protest with a aprox: "cannot assign to nil" A lot of thanks, regards