Exception: Horologium::UnknownOutputError

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

Overview

Raised when a representation is asked to come out in a type it does not have. It carries the types it does have so the caller can see the valid choices.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output, known_outputs) ⇒ UnknownOutputError

Returns a new instance of UnknownOutputError.

Parameters:

  • output (Object)

    the unknown output type that was asked for

  • known_outputs (Array<Symbol>)

    the types it can come out as



112
113
114
115
116
117
118
# File 'lib/horologium/error.rb', line 112

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

Instance Attribute Details

#known_outputsArray<Symbol> (readonly)

The types the representation can come out as.

Returns:

  • (Array<Symbol>)


108
109
110
# File 'lib/horologium/error.rb', line 108

def known_outputs
  @known_outputs
end