Exception: Plurimath::Formatter::UnsupportedBase

Inherits:
StandardError
  • Object
show all
Defined in:
lib/plurimath/errors/formatter/unsupported_base.rb

Instance Method Summary collapse

Constructor Details

#initialize(base, supported_bases) ⇒ UnsupportedBase

Returns a new instance of UnsupportedBase.



6
7
8
9
10
11
# File 'lib/plurimath/errors/formatter/unsupported_base.rb', line 6

def initialize(base, supported_bases)
  @base = base
  @supported = supported_bases.keys.map do |key|
    key.to_s.inspect
  end.join(", ")
end

Instance Method Details

#to_sObject



13
14
15
16
17
18
# File 'lib/plurimath/errors/formatter/unsupported_base.rb', line 13

def to_s
  <<~MESSAGE
    [plurimath] Unsupported base `#{@base}` for number formatting.
    [plurimath] The formatter `:base` option must be one of: #{@supported}.
  MESSAGE
end