Class: BaseN::Number
- Inherits:
-
Struct
- Object
- Struct
- BaseN::Number
- Defined in:
- lib/base_n.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#representation ⇒ Object
Returns the value of attribute representation.
Instance Method Summary collapse
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base
4 5 6 |
# File 'lib/base_n.rb', line 4 def base @base end |
#representation ⇒ Object
Returns the value of attribute representation
4 5 6 |
# File 'lib/base_n.rb', line 4 def representation @representation end |
Instance Method Details
#rebase(new_base) ⇒ Object
13 14 15 |
# File 'lib/base_n.rb', line 13 def rebase new_base Encoder.new(new_base).encode to_i end |
#to_i ⇒ Object
9 10 11 |
# File 'lib/base_n.rb', line 9 def to_i Encoder.new(base).decode self end |
#to_s ⇒ Object
5 6 7 |
# File 'lib/base_n.rb', line 5 def to_s representation end |