Optparse examples

I have a question about the optparse examples at
http://docs.meg.nu/local-docs/ruby/optparse/optparse.htmlWhat does the
following do ?if (Fixnum === :slight_smile:
class << vars
def inspect
"{" + collect {|k,v| โ€œ:#{k.id2name}=>#{v.inspect}โ€}.join(", ") + โ€œ}โ€œ
end
end
end
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.

Hi,

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 === :slight_smile:
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.

ยทยทยท

At Fri, 5 Dec 2003 13:32:05 +0900, Jeff Dickens wrote:

โ€“
Nobu Nakada