lib/getopt/long.rb in getopt-1.4.0 vs lib/getopt/long.rb in getopt-1.4.1

- old
+ new

@@ -15,11 +15,11 @@ # Error raised if an illegal option or argument is passed class Error < StandardError; end # The version of the getopt library - VERSION = '1.4.0' + VERSION = '1.4.1' # Takes an array of switches. Each array consists of up to three # elements that indicate the name and type of switch. Returns a hash # containing each switch name, minus the '-', as a key. The value # for each key depends on the type of switch and/or the value provided @@ -213,20 +213,20 @@ # for --test, and the user passes "--test", then set "-t" to the same # value that "--test" was set to. # # This allows users to refer to the long or short switch and get # the same value - hash.each{ |switch, val| + hash.dup.each{ |switch, val| if syns.keys.include?(switch) syns[switch] = [syns[switch]] if RUBY_VERSION.to_f >= 1.9 syns[switch].each{ |key| hash[key] = val } end } # Get rid of leading "--" and "-" to make it easier to reference - hash.each{ |key, value| + hash.dup.each{ |key, value| if key =~ /^-/ if key[0,2] == '--' nkey = key.sub('--', '') else nkey = key.sub('-', '')