SamovarSourceSamovarInvalidInputError

class InvalidInputError

Raised when invalid input is provided on the command line.

Definitions

def initialize(command, input)

Initialize a new invalid input error.

Signature

parameter command Command

The command that encountered the error.

parameter input Array(String)

The remaining input that could not be parsed.

Implementation

def initialize(command, input)
	@command = command
	@input = input
	
	super "Could not parse token #{input.first.inspect}"
end

def token

The token that could not be parsed.

Signature

returns String

The first unparsed token.

Implementation

def token
	@input.first
end

def help?

Check if the error was caused by a help request.

Signature

returns Boolean

True if the token is --help.

Implementation

def help?
	self.token == "--help"
end

attr :command

The command that encountered the error.

Signature

attribute Command

attr :input

The remaining input that could not be parsed.

Signature

attribute Array(String)