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 ===
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 ===
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