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


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

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueString


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

def value
  @value
end

Instance Method Details

#==(other) ⇒ Boolean


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

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

#mainnet?Boolean


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

def mainnet?
  @value == MAINNET
end

#testnet?Boolean


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

def testnet?
  @value == TESTNET
end

#to_sString


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

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