Skip to content
instance method

OptionParser::Arguable#getopts

(*::String args) -> ::Hash[::String, untyped]
getopts(*args, symbolize_names: false, **keywords)

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

Example
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
See also .extend_object #options #options= also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0