Class: Ruote::WfidGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/ruote/id/wfid_generator.rb

Direct Known Subclasses

MnemoWfidGenerator

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ WfidGenerator

Returns a new instance of WfidGenerator.



30
31
32
33
34
35
36
37
# File 'lib/ruote/id/wfid_generator.rb', line 30

def initialize(context)

  @context = context

  @last =
    @context.storage.get('variables', 'last_wfid') ||
    { 'type' => 'variables', '_id' => 'last_wfid', 'raw' => Time.now.utc.to_f }
end

Instance Method Details

#generateObject



39
40
41
42
43
44
# File 'lib/ruote/id/wfid_generator.rb', line 39

def generate

  raw = get_raw

  "#{raw.strftime('%Y%m%d%H%M%S')}-#{raw.usec}"
end