Class: Conflow::Flow::JobBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/conflow/flow/job_builder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Handles creating jobs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeJobBuilder

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize Conflow::Flow::JobBuilder with new empty context



12
13
14
# File 'lib/conflow/flow/job_builder.rb', line 12

def initialize
  @context = {}
end

Instance Attribute Details

#contextObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Holds mapping between worker classes and Job objects



9
10
11
# File 'lib/conflow/flow/job_builder.rb', line 9

def context
  @context
end

Instance Method Details

#call(worker_class, params, dependencies) ⇒ Conflow::Job+

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create new job and resolve it’s dependencies.



19
20
21
22
23
24
25
26
27
# File 'lib/conflow/flow/job_builder.rb', line 19

def call(worker_class, params, dependencies)
  job = initialize_job(worker_class)

  promises, params = extract_promises(job, params)
  dependencies = build_dependencies(promises, dependencies)
  assign_job_attributes(job, promises, params)

  [job, dependencies]
end