Class: Textus::Background::Job::Materialize

Inherits:
Base
  • Object
show all
Defined in:
lib/textus/background/job/materialize.rb

Constant Summary collapse

TYPE =
"materialize"

Instance Method Summary collapse

Methods inherited from Base

inherited

Constructor Details

#initialize(key:) ⇒ Materialize

Returns a new instance of Materialize.



9
10
11
12
# File 'lib/textus/background/job/materialize.rb', line 9

def initialize(key:)
  super()
  @key = key
end

Instance Method Details

#argsObject



14
# File 'lib/textus/background/job/materialize.rb', line 14

def args = { key: @key }

#call(container:, call:) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/textus/background/job/materialize.rb', line 16

def call(container:, call:)
  result = Textus::Pipeline::Engine.converge(container: container, call: call, keys: [@key])
  return unless result.is_a?(Hash)

  Array(result[:failed]).each do |failure|
    container.steps.publish(
      :produce_failed,
      ctx: Textus::Step::Context.for(container: container, call: call),
      keys: [failure["key"]], error: failure["error"]
    )
  end
end