Exception: Linen::CLI::AbstractAmbiguityError
- Inherits:
-
NameError
- Object
- NameError
- Linen::CLI::AbstractAmbiguityError
- 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
Instance Attribute Summary collapse
-
#candidates ⇒ Object
Returns the value of attribute candidates.
-
#input ⇒ Object
Returns the value of attribute input.
Instance Method Summary collapse
-
#initialize(candidates = [], input = '') ⇒ AbstractAmbiguityError
constructor
A new instance of AbstractAmbiguityError.
- #to_s ⇒ Object
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
#candidates ⇒ Object
Returns the value of attribute candidates.
30 31 32 |
# File 'lib/linen/exceptions.rb', line 30 def candidates @candidates end |
#input ⇒ Object
Returns the value of attribute input.
30 31 32 |
# File 'lib/linen/exceptions.rb', line 30 def input @input end |
Instance Method Details
#to_s ⇒ Object
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 |