Exception: Sinclair::Exception::InvalidOptions Private

Inherits:
Sinclair::Exception show all
Defined in:
lib/sinclair/exception.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Exception raised when invalid options are given

Examples:

Usage

exception = Sinclair::Exception::InvalidOptions.new(%i[invalid options])
exception.message
# return 'Invalid keys on options initialization (invalid options)'

Author:

  • Darthjee

Instance Method Summary collapse

Constructor Details

#initialize(invalid_keys = []) ⇒ InvalidOptions

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of InvalidOptions.

Parameters:

  • invalid_keys (Array<Symbol>) (defaults to: [])

    list of invalid keys



20
21
22
# File 'lib/sinclair/exception.rb', line 20

def initialize(invalid_keys = [])
  @invalid_keys = invalid_keys
end

Instance Method Details

#messageString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Exception string showing invalid keys

Examples:

Usage

exception = Sinclair::Exception::InvalidOptions.new(%i[invalid options])
exception.message
# return 'Invalid keys on options initialization (invalid options)'

Returns:

  • (String)


29
30
31
32
# File 'lib/sinclair/exception.rb', line 29

def message
  keys = invalid_keys.join(' ')
  "Invalid keys on options initialization (#{keys})"
end