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.



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

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



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

def value
  @value
end

Instance Method Details

#==(other) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/nis/unit/balance.rb', line 26

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

#in_nemFloat

Returns:

  • (Float)


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

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

#to_iInteger

Returns:

  • (Integer)


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

def to_i
  @value
end

#to_sString

Returns:

  • (String)


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

def to_s
  @value.to_s
end