Class: EXEL::Instruction

Inherits:
Object
  • Object
show all
Defined in:
lib/exel/instruction.rb

Overview

Represents one step to be executed in the processing of a job

Instance Method Summary collapse

Constructor Details

#initialize(processor_class, args, subtree: nil) ⇒ Instruction

Returns a new instance of Instruction.



6
7
8
9
10
# File 'lib/exel/instruction.rb', line 6

def initialize(processor_class, args, subtree: nil)
  @processor_class = processor_class
  @args = args || {}
  @subtree = subtree
end

Instance Method Details

#execute(context) ⇒ Object



12
13
14
15
16
# File 'lib/exel/instruction.rb', line 12

def execute(context)
  context.merge!(@args)
  processor = @processor_class.new(context)
  EXEL.middleware.invoke(@processor_class, context, @args) { processor.process(@subtree) }
end