lib/getopt/std.rb in getopt-1.4.1 vs lib/getopt/std.rb in getopt-1.4.2

- old
+ new

@@ -4,15 +4,15 @@ # The Getopt::Std class serves as a base class for the getopts method. class Std # The Getopt::Std::Error class is raised if there are any illegal # command line arguments. - # + # class Error < StandardError; end # The version of the getopt library - VERSION = '1.4.1' + VERSION = '1.4.2' # Processes single character command line options with option # clustering. This information is parsed from ARGV and returned # as a hash, with the switch (minus the "-") as the key. The value # for that key is either true/false (boolean switches) or the argument @@ -39,14 +39,14 @@ # if opt["o"] # case opt["o"] # # Do something # end # end - # + # def self.getopts(switches) args = switches.split(/ */) hash = {} - + while !ARGV.empty? && ARGV.first =~ /^-(.)(.*)/s first, rest = $1, $2 pos = switches.index(first) # Switches on the command line must appear among the characters