From: Arlen Cuss Date: 2008-03-09T14:00:25+09:00 Subject: Re: A question on singleton methods ------=_Part_43216_12678644.1205038834495 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, On Sun, Mar 9, 2008 at 3:39 PM, 7stud -- wrote: > A method name is not a string. > I think you're a bit off the mark. He's redefining an existing method with a new singleton one. >> h = {:a => 1} => {:a=>1} >> puts h.class => Hash $ ri Hash#length ------------------------------------------------------------ Hash#length hsh.length => fixnum hsh.size => fixnum ------------------------------------------------------------------------ Yet: >> def h.length >> puts "This works." >> end => nil >> A method name is not a fixnum, either. He's not trying to define a method called 'alpha', it was changing the definition of to_s. Arlen ------=_Part_43216_12678644.1205038834495--