Sha256: 52812f78b18d51c3f3eaa06251771e1c5164155e299f96769bf8fbf8fbb85b1b

Contents?: true

Size: 577 Bytes

Versions: 6

Compression:

Stored size: 577 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

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

      end

    end

  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
clamp-0.2.3 lib/clamp/parameter/parsing.rb
clamp-0.2.2 lib/clamp/parameter/parsing.rb
clamp-0.2.1 lib/clamp/parameter/parsing.rb
clamp-0.2.0 lib/clamp/parameter/parsing.rb
wpb-0.0.5 lib/wpb/clamp/parameter/parsing.rb
clamp-0.1.8 lib/clamp/parameter/parsing.rb