Class: Andromeda::Id
- Inherits:
-
Andromeda::Impl::XorId
- Object
- Andromeda::Impl::XorId
- Andromeda::Id
- Defined in:
- lib/andromeda/id.rb
Constant Summary collapse
- DEFAULT_NUM_BYTES =
Default length of generated ids
8
Class Method Summary collapse
-
.zero ⇒ Id
Empty (zero) id.
Instance Method Summary collapse
-
#initialize(random = true) ⇒ Id
constructor
A new instance of Id.
Methods inherited from Andromeda::Impl::XorId
#==, #[], #clone_to_copy?, #each, #each_with_index, #hash, #identical_copy, #inspect, #length, #same_length?, #to_short_s, #xor, #zero?
Methods included from Andromeda::Impl::To_S
Constructor Details
#initialize(random = true) ⇒ Id
Returns a new instance of Id.
8 9 10 |
# File 'lib/andromeda/id.rb', line 8 def initialize(random = true) super DEFAULT_NUM_BYTES, random end |
Class Method Details
.zero ⇒ Id
Returns empty (zero) id.
13 14 15 16 |
# File 'lib/andromeda/id.rb', line 13 def self.zero @id = self.new false unless defined? @id @id end |