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
Source Code
# File optparse.rb, line 1752 def getopts(*args) options.getopts(self, *args) end
<code/>and<pre/>for code samples.