From: nobu.nokada@... Date: 2003-12-08T17:26:28+09:00 Subject: Re: optparse examples Hi, At Fri, 5 Dec 2003 13:32:05 +0900, Jeff Dickens wrote: > > I have a question about the optparse examples at > http://docs.meg.nu/local-docs/ruby/optparse/optparse.html > What does the following do ? > if (Fixnum === :-) > class << vars > def inspect > "{" + collect {|k,v| ":#{k.id2name}=>#{v.inspect}"}.join(", ") + "}" > end > end > end In older version, ruby didn't have Symbol class and symbols are just Fixnum. The code is to show the hash keys as symbols. > and then this line which is commented out: #opts.variable.each {|sym| puts > "#{sym} = #{opts.send(sym).inspect}"}Looks like some kind of debug code, but > I thought if I understood it itshed some light on things in general. Eariest OptionParser had #variable method, but it has been abolished long ago. -- Nobu Nakada