Exception: Samovar::InvalidInputError
- Defined in:
- lib/samovar/error.rb
Overview
Raised when invalid input is provided on the command line.
Instance Attribute Summary collapse
-
#command ⇒ Object
The command that encountered the error.
-
#input ⇒ Object
readonly
The remaining input that could not be parsed.
Instance Method Summary collapse
-
#help? ⇒ Boolean
Check if the error was caused by a help request.
-
#initialize(command, input) ⇒ InvalidInputError
constructor
Initialize a new invalid input error.
-
#token ⇒ Object
The token that could not be parsed.
Constructor Details
#initialize(command, input) ⇒ InvalidInputError
Initialize a new invalid input error.
17 18 19 20 21 22 |
# File 'lib/samovar/error.rb', line 17 def initialize(command, input) @command = command @input = input super "Could not parse token #{input.first.inspect}" end |
Instance Attribute Details
#command ⇒ Object
The command that encountered the error.
41 42 43 |
# File 'lib/samovar/error.rb', line 41 def command @command end |
#input ⇒ Object (readonly)
The remaining input that could not be parsed.
46 47 48 |
# File 'lib/samovar/error.rb', line 46 def input @input end |
Instance Method Details
#help? ⇒ Boolean
Check if the error was caused by a help request.
34 35 36 |
# File 'lib/samovar/error.rb', line 34 def help? self.token == "--help" end |
#token ⇒ Object
The token that could not be parsed.
27 28 29 |
# File 'lib/samovar/error.rb', line 27 def token @input.first end |