Exception: Expressir::InvalidOptionError
- Inherits:
-
UsageError
- Object
- StandardError
- Error
- UsageError
- Expressir::InvalidOptionError
- Defined in:
- lib/expressir/errors.rb
Instance Attribute Summary collapse
-
#option_name ⇒ Object
readonly
Returns the value of attribute option_name.
-
#valid_options ⇒ Object
readonly
Returns the value of attribute valid_options.
Attributes inherited from UsageError
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(option_name, value, valid_options: nil) ⇒ InvalidOptionError
constructor
A new instance of InvalidOptionError.
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 = msg = "Invalid value '#{value}' for #{option_name}" msg += ". Valid options: #{.join(', ')}" if super(msg) end |
Instance Attribute Details
#option_name ⇒ Object (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_options ⇒ Object (readonly)
Returns the value of attribute valid_options.
56 57 58 |
# File 'lib/expressir/errors.rb', line 56 def @valid_options end |