Class: Nem::Unit::Version

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

Constant Summary collapse

TESTNET =

-1744830464

0x98 << 24
MAINNET =

1744830464

0x68 << 24
MIJIN =
0x60 << 24
MASK_VERSION =
0x00000003
MASK_NETWORK =
0xfffffffc

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Version

Returns a new instance of Version.



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

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueString

Returns the current value of value.

Returns:

  • (String)

    the current value of value



4
5
6
# File 'lib/nem/unit/version.rb', line 4

def value
  @value
end

Instance Method Details

#==(other) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/nem/unit/version.rb', line 45

def ==(other)
  version == other
end

#networkInteger

Returns:

  • (Integer)


24
25
26
# File 'lib/nem/unit/version.rb', line 24

def network
  @network ||= value & MASK_NETWORK
end

#to_iInteger

Returns:

  • (Integer)


40
41
42
# File 'lib/nem/unit/version.rb', line 40

def to_i
  value.to_i
end

#to_sString

Returns:

  • (String)


35
36
37
# File 'lib/nem/unit/version.rb', line 35

def to_s
  to_i.to_s
end

#versionInteger

Returns:

  • (Integer)


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

def version
  @version ||= value & MASK_VERSION
end