Sha256: 53a95e2d3e00af2bdaf8a1e2abb61081fbce77ef6a85676de0dc73a7720bc6c8

Contents?: true

Size: 623 Bytes

Versions: 2

Compression:

Stored size: 623 Bytes

Contents

module Clamp
  module Parameter

    module Parsing

      protected

      def parse_parameters

        self.class.parameters.each do |parameter|
          begin
            parameter.consume(remaining_arguments).each do |value|
              parameter.of(self).take(value)
            end
          rescue ArgumentError => e
            signal_usage_error Clamp.message(:parameter_argument_error, :param => parameter.name, :message => e.message)
          end
        end

        self.class.parameters.each do |parameter|
          parameter.of(self).default_from_environment
        end

      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
clamp-1.0.1 lib/clamp/parameter/parsing.rb
clamp-1.0.0 lib/clamp/parameter/parsing.rb