Class: Kraps::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/kraps/runner.rb

Defined Under Namespace

Classes: StepRunner

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Runner

Returns a new instance of Runner.



3
4
5
# File 'lib/kraps/runner.rb', line 3

def initialize(klass)
  @klass = klass
end

Instance Method Details

#call(*args, **kwargs) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/kraps/runner.rb', line 7

def call(*args, **kwargs)
  JobResolver.new.call(@klass.new(*args, **kwargs).call).tap do |jobs|
    jobs.each_with_index do |job, job_index|
      job.steps.each_with_index.inject(nil) do |frame, (_, step_index)|
        StepRunner.new(
          klass: @klass,
          args: args,
          kwargs: kwargs,
          jobs: jobs,
          job_index: job_index,
          step_index: step_index,
          frame: frame
        ).call
      end
    end
  end
end