Class: Taskinator::CreateProcessWorker

Inherits:
Object
  • Object
show all
Defined in:
lib/taskinator/create_process_worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition_name, uuid, args) ⇒ CreateProcessWorker

Returns a new instance of CreateProcessWorker.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/taskinator/create_process_worker.rb', line 8

def initialize(definition_name, uuid, args)

  # convert to the module
  @definition = constantize(definition_name)

  # this will be uuid of the created process
  @uuid = uuid

  # convert to the typed arguments
  @args = Taskinator::Persistence.deserialize(args)

end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



6
7
8
# File 'lib/taskinator/create_process_worker.rb', line 6

def args
  @args
end

#definitionObject (readonly)

Returns the value of attribute definition.



4
5
6
# File 'lib/taskinator/create_process_worker.rb', line 4

def definition
  @definition
end

#uuidObject (readonly)

Returns the value of attribute uuid.



5
6
7
# File 'lib/taskinator/create_process_worker.rb', line 5

def uuid
  @uuid
end

Instance Method Details

#performObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/taskinator/create_process_worker.rb', line 21

def perform

  # args may contain an options hash at the end
  # so merge in the uuid into it, or add

  process_args = args || []

  if process_args.last.is_a?(Hash)
    process_args.last.merge!(:uuid => uuid)
  else
    process_args << { :uuid => uuid }
  end

  @definition._create_process_(false, *process_args).enqueue!

end