Class: Nis::Unit::Version

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

Constant Summary collapse

MAINNET =
1_744_830_465
TESTNET =
-1_744_830_463

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Version

Returns a new instance of Version.



9
10
11
# File 'lib/nis/unit/version.rb', line 9

def initialize(value)
  @value = value
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/version.rb', line 3

def value
  @value
end

Instance Method Details

#==(other) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/nis/unit/version.rb', line 31

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

#mainnet?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/nis/unit/version.rb', line 14

def mainnet?
  @value == MAINNET
end

#testnet?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/nis/unit/version.rb', line 19

def testnet?
  @value == TESTNET
end

#to_sString

Returns:

  • (String)


24
25
26
27
28
# File 'lib/nis/unit/version.rb', line 24

def to_s
  testnet? ? 'testnet' :
    mainnet? ? 'mainnet' :
      'unexpected'
end