Class: Burner::Step

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/burner/step.rb

Overview

A wrapper to execute a job (in the context of a Pipeline.)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job) ⇒ Step

Returns a new instance of Step.

Raises:

  • (ArgumentError)


23
24
25
26
27
28
29
# File 'lib/burner/step.rb', line 23

def initialize(job)
  raise ArgumentError, 'job is required' unless job

  @job = job

  freeze
end

Instance Attribute Details

#jobObject (readonly)

Returns the value of attribute job.



19
20
21
# File 'lib/burner/step.rb', line 19

def job
  @job
end

Instance Method Details

#perform(output, payload) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/burner/step.rb', line 31

def perform(output, payload)
  output.title("#{job.class.name}#{SEPARATOR}#{job.name}")

  time_in_seconds = Benchmark.measure do
    job.perform(output, payload)
  end.real.round(3)

  output.complete(time_in_seconds)
end