Class: Nis::Unit::Balance
- Inherits:
-
Object
- Object
- Nis::Unit::Balance
- Includes:
- Comparable
- Defined in:
- lib/nis/unit/balance.rb
Instance Attribute Summary collapse
-
#value ⇒ String
The current value of value.
Instance Method Summary collapse
- #<=>(other) ⇒ Boolean
- #in_nem ⇒ Float
-
#initialize(value) ⇒ Balance
constructor
A new instance of Balance.
- #to_i ⇒ Integer
- #to_s ⇒ String
Constructor Details
#initialize(value) ⇒ Balance
Returns a new instance of Balance.
8 9 10 |
# File 'lib/nis/unit/balance.rb', line 8 def initialize(value) @value = value.to_i end |
Instance Attribute Details
#value ⇒ String
Returns the current value of value.
3 4 5 |
# File 'lib/nis/unit/balance.rb', line 3 def value @value end |
Instance Method Details
#<=>(other) ⇒ Boolean
28 29 30 |
# File 'lib/nis/unit/balance.rb', line 28 def <=>(other) @value <=> other.to_i end |
#in_nem ⇒ Float
13 14 15 |
# File 'lib/nis/unit/balance.rb', line 13 def in_nem @value.to_f / 1_000_000 end |
#to_i ⇒ Integer
23 24 25 |
# File 'lib/nis/unit/balance.rb', line 23 def to_i @value end |
#to_s ⇒ String
18 19 20 |
# File 'lib/nis/unit/balance.rb', line 18 def to_s @value.to_s end |