lib/thor/parser/arguments.rb in thor-0.15.4 vs lib/thor/parser/arguments.rb in thor-0.16.0

- old
+ new

@@ -142,10 +142,16 @@ # def parse_string(name) if no_or_skip?(name) nil else - shift + value = shift + if @switches.is_a?(Hash) && switch = @switches[name] + if switch.enum && !switch.enum.include?(value) + raise MalformattedArgumentError, "Expected '#{name}' to be one of #{switch.enum.join(', ')}; got #{value}" + end + end + value end end # Raises an error if @non_assigned_required array is not empty. #