Class: Plurimath::Formatter::Numbers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/plurimath/formatter/numbers/base.rb

Direct Known Subclasses

Fraction, Integer, Significant

Constant Summary collapse

HEX_ALPHANUMERIC =
%w[0 1 2 3 4 5 6 7 8 9 a b c d e f].freeze
DEFAULT_BASE =
10
DIGIT_VALUE =
HEX_ALPHANUMERIC.each_with_index.to_h

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbols = {}) ⇒ Base

Returns a new instance of Base.



13
14
15
16
# File 'lib/plurimath/formatter/numbers/base.rb', line 13

def initialize(symbols = {})
  @symbols = symbols
  @base = symbols[:base] || DEFAULT_BASE
end

Instance Attribute Details

#baseObject

Returns the value of attribute base.



11
12
13
# File 'lib/plurimath/formatter/numbers/base.rb', line 11

def base
  @base
end

#symbolsObject

Returns the value of attribute symbols.



11
12
13
# File 'lib/plurimath/formatter/numbers/base.rb', line 11

def symbols
  @symbols
end