lib/slop/option.rb in slop-1.0.0 vs lib/slop/option.rb in slop-1.1.0

- old
+ new

@@ -1,16 +1,20 @@ class Slop class Options < Array - def to_hash - each_with_object({}) do |option, out| - out[option.key] = option.argument_value + def to_hash(symbols) + out = {} + each do |option| + key = option.key + key = key.to_sym if symbols + out[key] = option.argument_value end + out end def [](item) item = item.to_s if item =~ /^\d+$/ - slice(item.to_i) + slice item.to_i else find do |option| option.short_flag == item || option.long_flag == item end end