Exception: Horologium::UnknownRepresentationError

Inherits:
Error
  • Object
show all
Defined in:
lib/horologium/error.rb,
sig/horologium.rbs

Overview

Raised when a representation the library does not have is asked for. It carries the known representations so the caller can see the valid choices.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(representation, known_representations) ⇒ UnknownRepresentationError

Returns a new instance of UnknownRepresentationError.

Parameters:

  • representation (Object)

    the unknown representation asked for

  • known_representations (Array<Symbol>)

    the known representations



92
93
94
95
96
97
98
# File 'lib/horologium/error.rb', line 92

def initialize(representation, known_representations)
  @known_representations = known_representations.dup.freeze
  super(
    "unknown representation #{representation.inspect}, " \
    "expected one of #{known_representations.map(&:inspect).join(", ")}"
  )
end

Instance Attribute Details

#known_representationsArray<Symbol> (readonly)

The representations the library has.

Returns:

  • (Array<Symbol>)


88
89
90
# File 'lib/horologium/error.rb', line 88

def known_representations
  @known_representations
end