lib/clamp/parameter/parsing.rb in clamp-0.5.1 vs lib/clamp/parameter/parsing.rb in clamp-0.6.0

- old
+ new

@@ -1,18 +1,19 @@ module Clamp - class Parameter + module Parameter module Parsing protected def parse_parameters self.class.parameters.each do |parameter| begin - value = parameter.consume(remaining_arguments) - send("#{parameter.attribute_name}=", value) unless value.nil? + parameter.consume(remaining_arguments).each do |value| + send(parameter.write_method, value) + end rescue ArgumentError => e signal_usage_error "parameter '#{parameter.name}': #{e.message}" end end @@ -23,10 +24,10 @@ self.class.parameters.each do |parameter| next if parameter.environment_variable.nil? next unless ENV.has_key?(parameter.environment_variable) # Set the parameter value if it's environment variable is present value = ENV[parameter.environment_variable] - send("#{parameter.attribute_name}=", value) + send(parameter.write_method, value) end end end