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.



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

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

Instance Method Details

#execute(context) ⇒ Object



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

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