Parse string: for –string-arg, just return the current value in the pile
for –no-string-arg, nil Check if
the peek is included in
enum if enum is provided. Otherwise raises an error.
# File lib/bundler/vendor/thor/lib/thor/parser/arguments.rb, line 150
def parse_string(name)
if no_or_skip?(name)
nil
else
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