class Ame::Arguments::Complete

The arguments to a method in its {Method::Undefined undefined state} where a splat or splus has been added and thus no further arguments are allowed. @api internal

Public Class Methods

new(arguments, splat_command, splat) click to toggle source
# File lib/ame-1.0/arguments/complete.rb, line 6
def initialize(arguments, splat_command, splat)
  @arguments, @splat_command, @splat = arguments + [splat], splat_command, splat
end

Public Instance Methods

argument(name, type, description, &validate) click to toggle source

@raise [ArgumentError] If a splat or splus argument has been defined

# File lib/ame-1.0/arguments/complete.rb, line 11
def argument(name, type, description, &validate)
  error 'argument', name
end
optional(name, default, description, &validate) click to toggle source

@raise [ArgumentError] If a splat or splus argument has been defined

# File lib/ame-1.0/arguments/complete.rb, line 16
def optional(name, default, description, &validate)
  error 'optional', name
end
splat(name, type, description, &validate) click to toggle source

@raise [ArgumentError] If a splat or splus argument has been defined

# File lib/ame-1.0/arguments/complete.rb, line 21
def splat(name, type, description, &validate)
  error 'splat', name
end
splus(name, type, description, &validate) click to toggle source

@raise [ArgumentError] If a splat or splus argument has been defined

# File lib/ame-1.0/arguments/complete.rb, line 26
def splus(name, type, description, &validate)
  error 'splus', name
end

Private Instance Methods

error(command, name) click to toggle source
# File lib/ame-1.0/arguments/complete.rb, line 32
def error(command, name)
  raise ArgumentError, "%s '%s', … may not follow %s '%s', …" %
    [command, name, @splat_command, @splat.name]
end