Sha256: 2c9b7ba0a75fadf426d11065d673e6098e03782e52e2e5d29ae4d6302f475c24

Contents?: true

Size: 1.12 KB

Versions: 28

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

class Sinclair
  # @api private
  # @author Darthjee
  #
  # Excaptions raised by sinclair
  class Exception < StandardError
    # @api private
    # @author Darthjee
    #
    # Exception raised when invalid options are given
    #
    # @example Usage
    #   exception = Sinclair::Exception::InvalidOptions.new(%i[invalid options])
    #   exception.message
    #   # return 'Invalid keys on options initialization (invalid options)'
    class InvalidOptions < Sinclair::Exception
      # @param invalid_keys [Array<Symbol>] list of invalid keys
      def initialize(invalid_keys = [])
        @invalid_keys = invalid_keys
      end

      # Exception string showing invalid keys
      #
      # @return [String]
      #
      # @example (see InvalidOptions)
      def message
        keys = invalid_keys.join(' ')
        "Invalid keys on options initialization (#{keys})"
      end

      private

      attr_reader :invalid_keys
      # @method invalid_keys
      # @api private
      # @private
      #
      # invalid keys on options initialization
      #
      # @return [Array<Symbol>]
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
sinclair-2.1.1 lib/sinclair/exception.rb
sinclair-2.1.0 lib/sinclair/exception.rb
sinclair-2.0.1 lib/sinclair/exception.rb
sinclair-2.0.0 lib/sinclair/exception.rb
sinclair-1.16.3 lib/sinclair/exception.rb
sinclair-1.16.2 lib/sinclair/exception.rb
sinclair-1.16.1 lib/sinclair/exception.rb
sinclair-1.16.0 lib/sinclair/exception.rb
sinclair-1.15.0 lib/sinclair/exception.rb
sinclair-1.14.2 lib/sinclair/exception.rb
sinclair-1.14.1 lib/sinclair/exception.rb
sinclair-1.14.0 lib/sinclair/exception.rb
sinclair-1.13.0 lib/sinclair/exception.rb
sinclair-1.12.1 lib/sinclair/exception.rb
sinclair-1.12.0 lib/sinclair/exception.rb
sinclair-1.11.0 lib/sinclair/exception.rb
sinclair-1.10.0 lib/sinclair/exception.rb
sinclair-1.9.0 lib/sinclair/exception.rb
sinclair-1.8.0 lib/sinclair/exception.rb
sinclair-1.7.0 lib/sinclair/exception.rb