Module: Ciql::UUID

Defined in:
lib/ciql/uuid.rb

Class Method Summary collapse

Class Method Details

.ending(time) ⇒ SimpleUUID::UUID

Create a fake time UUID that sorts as the largest for a timestamp

Parameters:

  • time (Time)

Returns:

  • (SimpleUUID::UUID)


20
21
22
# File 'lib/ciql/uuid.rb', line 20

def self.ending(time)
  create_uuid((time.stamp + 1) * 10 - 1, 0x7f7f7f7f7f7f7f7f)
end

.starting(time) ⇒ SimpleUUID::UUID

Create a fake time UUID that sorts as the smallest for a timestamp

Parameters:

  • time (Time)

Returns:

  • (SimpleUUID::UUID)


11
12
13
# File 'lib/ciql/uuid.rb', line 11

def self.starting(time)
  create_uuid(time.stamp * 10, 0x8080808080808080)
end