Flowdock
method

getopts

Importance_1
Ruby latest stable (v1_9_3_392) - 0 notes - Class: Arguable
getopts(*args) public

Substitution of getopts is possible as follows. Also see OptionParser#getopts.

def getopts(*args)
  ($OPT = ARGV.getopts(*args)).each do |opt, val|
    eval "$OPT_#{opt.gsub(/[^A-Za-z0-9_]/, '_')} = val"
  end
rescue OptionParser::ParseError
end
Show source
Register or log in to add new notes.