Class: Nis::Unit::Balance

Inherits:
Object
  • Object
show all
Defined in:
lib/nis/unit/balance.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Balance

Returns a new instance of Balance.



7
8
9
# File 'lib/nis/unit/balance.rb', line 7

def initialize(value)
  @value = value.to_i
end

Instance Attribute Details

#valueString

Returns the current value of value.

Returns:

  • (String)

    the current value of value



4
5
6
# File 'lib/nis/unit/balance.rb', line 4

def value
  @value
end

#value_in_nemString

Returns the current value of value_in_nem.

Returns:

  • (String)

    the current value of value_in_nem



4
5
6
# File 'lib/nis/unit/balance.rb', line 4

def value_in_nem
  @value_in_nem
end

Instance Method Details

#==(other) ⇒ Object



24
25
26
# File 'lib/nis/unit/balance.rb', line 24

def ==(other)
  @value == other.value
end

#in_nemFloat

Returns:

  • (Float)


12
13
14
# File 'lib/nis/unit/balance.rb', line 12

def in_nem
  @value_in_nem ||= @value.to_f / 1_000_000
end

#to_iObject



20
21
22
# File 'lib/nis/unit/balance.rb', line 20

def to_i
  @value
end

#to_sObject



16
17
18
# File 'lib/nis/unit/balance.rb', line 16

def to_s
  @value.to_s
end