Sha256: 722a6e63587767f28909a2dfcfbcc124c8ea1a6062231e385fdf24930d9b9784

Contents?: true

Size: 559 Bytes

Versions: 7

Compression:

Stored size: 559 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)
          rescue ArgumentError => e
            signal_usage_error "parameter '#{parameter.name}': #{e.message}"
          end
        end

        unless remaining_arguments.empty?
          signal_usage_error "too many arguments"
        end

      end

    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
clamp-0.1.7 lib/clamp/parameter/parsing.rb
clamp-0.1.6 lib/clamp/parameter/parsing.rb
clamp-0.1.5 lib/clamp/parameter/parsing.rb
clamp-0.1.4 lib/clamp/parameter/parsing.rb
clamp-0.1.3 lib/clamp/parameter/parsing.rb
clamp-0.1.2 lib/clamp/parameter/parsing.rb
clamp-0.1.1 lib/clamp/parameter/parsing.rb