Exception: Horologium::UnknownScaleError

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

Overview

Raised when a time scale that is not registered is asked for. It carries the registered scales so the caller can see the valid choices.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scale, known_scales) ⇒ UnknownScaleError

Returns a new instance of UnknownScaleError.

Parameters:

  • scale (Object)

    the unknown scale that was asked for

  • known_scales (Array<Symbol>)

    the registered scales



73
74
75
76
77
78
79
# File 'lib/horologium/error.rb', line 73

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

Instance Attribute Details

#known_scalesArray<Symbol> (readonly)

The scales registered when the error was raised.

Returns:

  • (Array<Symbol>)


69
70
71
# File 'lib/horologium/error.rb', line 69

def known_scales
  @known_scales
end