Exception: Acclaim::Option::Parser::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/acclaim/option/parser/error.rb

Overview

Errors raised by the parser.

Since:

  • 0.0.1

Class Method Summary collapse

Class Method Details

.raise_missing_required(option) ⇒ Object

Raises an Error with the following error message:

Missing required argument (#{option.names.join '|'})

Raises:

  • (self)

Since:

  • 0.0.1



18
19
20
21
# File 'lib/acclaim/option/parser/error.rb', line 18

def self.raise_missing_required(option)
  names = option.names.join '|'
  raise self, "Missing required argument (#{names})"
end

.raise_multiple(option) ⇒ Object

Raises an error with the following error message:

Multiple instances of [#{options.names.join ''}] encountered

Raises:

  • (self)

Since:

  • 0.0.1



26
27
28
29
# File 'lib/acclaim/option/parser/error.rb', line 26

def self.raise_multiple(option)
  names = option.names.join '|'
  raise self, "Multiple instances of [#{names}] encountered"
end

.raise_wrong_arg_number(actual, minimum, optional) ⇒ Object

Raises an Error with the following error message:

Wrong number of arguments (#{actual} for #{minimum})

Raises:

  • (self)

Since:

  • 0.0.1



11
12
13
# File 'lib/acclaim/option/parser/error.rb', line 11

def self.raise_wrong_arg_number(actual, minimum, optional)
  raise self, "Wrong number of arguments (#{actual} for #{minimum})"
end