Class: Zold::Id
- Inherits:
-
Object
- Object
- Zold::Id
- Defined in:
- lib/zold/id.rb
Overview
Id of the wallet
Constant Summary collapse
- ROOT =
Id.new('0000000000000000')
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(id = nil) ⇒ Id
constructor
A new instance of Id.
- #to_s ⇒ Object
Constructor Details
#initialize(id = nil) ⇒ Id
Returns a new instance of Id.
28 29 30 |
# File 'lib/zold/id.rb', line 28 def initialize(id = nil) @id = id.nil? ? rand(2**32..2**64 - 1) : Integer("0x#{id}", 16) end |
Instance Method Details
#==(other) ⇒ Object
34 35 36 |
# File 'lib/zold/id.rb', line 34 def==(other) to_s == other.to_s end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/zold/id.rb', line 38 def to_s format('%016x', @id) end |