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
# File 'lib/plurimath/errors/formatter/unsupported_base.rb', line 6

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

Instance Method Details

#to_sObject



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

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