class Ame::Multioption

Represents an option to a {Method} that takes an argument that can be given any number of times. If an explicit (‘=’-separated) argument is given, it’ll be used, otherwise the following argument will be used. @api developer

Public Class Methods

new(short, long, argument, type, description, &validate) click to toggle source

@api internal @param (see Option#initialize) @param [::Class] type @yield (see Option#initialize) @yieldparam (see Option#initialize) @raise (see Flag#initialize) @raise [ArgumentError] If TYPE isn’t one that Ame knows how to parse

Calls superclass method Ame::Option::new
# File lib/ame-1.0/multioption.rb, line 14
def initialize(short, long, argument, type, description, &validate)
  super short, long, argument, nil, description, &validate
  @type = Ame::Types[type]
  @ignored = true
end

Public Instance Methods

ignored?() click to toggle source

@return True if the receiver hasn’t been asked to process any options yet

# File lib/ame-1.0/multioption.rb, line 32
def ignored?
  @ignored
end
process(options, arguments, name, explicit) click to toggle source

Invokes {super} and adds it to an Array added to OPTIONS before returning it. @api internal @param (see Flag#process) @raise (see Flag#process) @return [Object]

Calls superclass method Ame::Flag#process
# File lib/ame-1.0/multioption.rb, line 26
def process(options, arguments, name, explicit)
  @ignored = false
  (options[self.name] ||= []) << super
end