class Ame::Arguments
The arguments to a method in its {Method defined state}. Does the processing of arguments to the method and also enumerates {#each} of the arguments to the method for, for example, help output. @api developer
Public Class Methods
new(arguments)
click to toggle source
# File lib/ame-1.0/arguments.rb, line 9 def initialize(arguments) @arguments = arguments end
Public Instance Methods
each() { |argument| ... }
click to toggle source
@overload
Enumerates the arguments. @yieldparam [Argument] argument
@overload
@return [Enumerator<Argument>] An Enumerator over the arguments
# File lib/ame-1.0/arguments.rb, line 36 def each return enum_for(__method__) unless block_given? @arguments.each do |argument| yield argument end self end
process(options, arguments)
click to toggle source
@api internal @param [Hash<String, Object>] options @param [Array<String>] arguments @raise [SuperfluousArgument] If more arguments than required/optional have
been given
@raise (see Argument#process) @return [Array<Object>] The {Argument#process}ed arguments
# File lib/ame-1.0/arguments.rb, line 20 def process(options, arguments) unprocessed = arguments.dup reduce([]){ |processed, argument| processed << argument.process(options, processed, unprocessed) }.tap{ raise Ame::SuperfluousArgument, 'superfluous arguments: %s' % unprocessed.join(' ') unless unprocessed.empty? } end