Exception: Expressir::InvalidOptionError

Inherits:
UsageError show all
Defined in:
lib/expressir/errors.rb

Instance Attribute Summary collapse

Attributes inherited from UsageError

#usage_hint

Attributes inherited from Error

#details

Instance Method Summary collapse

Constructor Details

#initialize(option_name, value, valid_options: nil) ⇒ InvalidOptionError

Returns a new instance of InvalidOptionError.



58
59
60
61
62
63
64
# File 'lib/expressir/errors.rb', line 58

def initialize(option_name, value, valid_options: nil)
  @option_name = option_name
  @valid_options = valid_options
  msg = "Invalid value '#{value}' for #{option_name}"
  msg += ". Valid options: #{valid_options.join(', ')}" if valid_options
  super(msg)
end

Instance Attribute Details

#option_nameObject (readonly)

Returns the value of attribute option_name.



56
57
58
# File 'lib/expressir/errors.rb', line 56

def option_name
  @option_name
end

#valid_optionsObject (readonly)

Returns the value of attribute valid_options.



56
57
58
# File 'lib/expressir/errors.rb', line 56

def valid_options
  @valid_options
end