Module: Dial::Util

Defined in:
lib/dial/util.rb

Class Method Summary collapse

Class Method Details

.file_name_uuid(file_name) ⇒ Object



12
13
14
# File 'lib/dial/util.rb', line 12

def file_name_uuid file_name
  file_name.split("_").first
end

.uuidObject



8
9
10
# File 'lib/dial/util.rb', line 8

def uuid
  SecureRandom.uuid_v7
end

.uuid_timestamp(uuid) ⇒ Object



16
17
18
19
# File 'lib/dial/util.rb', line 16

def uuid_timestamp uuid
  high_bits_hex = uuid.split("-").first(2).join[0, 12].to_i 16
  Time.at high_bits_hex / 1000.0
end