Exception: Optionable::Invalid

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/optionable/invalid.rb

Overview

This exception is raised whenever invalid options are found during validation.

Since:

  • 0.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value, allowed) ⇒ Invalid

Initialize the Invalid option exception.

Examples:

Initialize the exception.

Optionable::Invalid.new(:test, 10, [ 11, 12 ])

Parameters:

  • key (Symbol)

    The name of the option.

  • value (Object)

    The value provided for the option.

  • allowed (Array<Object>)

    The allowed values for the option.

Since:

  • 0.0.0



28
29
30
31
32
33
# File 'lib/optionable/invalid.rb', line 28

def initialize(key, value, allowed)
  @key = key
  @value = value
  @allowed = allowed
  super(generate_message)
end

Instance Attribute Details

#allowedObject

Since:

  • 0.0.0



16
# File 'lib/optionable/invalid.rb', line 16

attr_reader :key, :value, :allowed

#keySymbol

Returns The name of the option.

Returns:

  • (Symbol)

    The name of the option.



16
17
18
# File 'lib/optionable/invalid.rb', line 16

def key
  @key
end

#valueObject

Returns The value provided for the option.

Returns:

  • (Object)

    The value provided for the option.



16
# File 'lib/optionable/invalid.rb', line 16

attr_reader :key, :value, :allowed