Sha256: 31d0ad258561a24d877190b1e8aba136920ff901136d59c6912be5c21c91b6a6
Contents?: true
Size: 885 Bytes
Versions: 4
Compression:
Stored size: 885 Bytes
Contents
module Clamp class 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? rescue ArgumentError => e signal_usage_error "parameter '#{parameter.name}': #{e.message}" end end end def parse_environment_parameters 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) end end end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
clamp-0.5.1 | lib/clamp/parameter/parsing.rb |
clamp-0.5.0 | lib/clamp/parameter/parsing.rb |
clamp-0.4.0 | lib/clamp/parameter/parsing.rb |
jls-clamp-0.3.1.2 | lib/clamp/parameter/parsing.rb |