Exception: Linen::CLI::AbstractAmbiguityError

Inherits:
NameError
  • Object
show all
Defined in:
lib/linen/exceptions.rb

Overview

ambiguity errors can sometimes carry a payload of possible completions for the ambiguous input; those are stored in the exception when it’s raised.

Direct Known Subclasses

AmbiguousCommandError, AmbiguousPluginError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(candidates = [], input = '') ⇒ AbstractAmbiguityError

Returns a new instance of AbstractAmbiguityError.



32
33
34
35
# File 'lib/linen/exceptions.rb', line 32

def initialize( candidates = [], input = '' )
	@candidates = candidates
	@input      = input
end

Instance Attribute Details

#candidatesObject

Returns the value of attribute candidates.



30
31
32
# File 'lib/linen/exceptions.rb', line 30

def candidates
  @candidates
end

#inputObject

Returns the value of attribute input.



30
31
32
# File 'lib/linen/exceptions.rb', line 30

def input
  @input
end

Instance Method Details

#to_sObject



37
38
39
40
41
# File 'lib/linen/exceptions.rb', line 37

def to_s
	type = self.class.to_s.match( /Ambiguous(.*?)Error/ )[1].downcase

	return "The #{type} you entered ('#{@input}') was ambiguous; please select from the following: #{@candidates.join ', '}"
end