Class: Retl::PathHandler

Inherits:
Handler show all
Defined in:
lib/retl/handlers/path_handler.rb

Instance Attribute Summary

Attributes inherited from Handler

#description

Instance Method Summary collapse

Methods inherited from Handler

#output, #push_in

Constructor Details

#initialize(path, dependencies = {}, &block) ⇒ PathHandler

Returns a new instance of PathHandler.



5
6
7
8
9
10
# File 'lib/retl/handlers/path_handler.rb', line 5

def initialize(path, dependencies={}, &block)
  super()
  @path = path
  dependencies.merge!(block.call) if block
  @context = Context.new(@path, dependencies)
end

Instance Method Details

#call(data, context) ⇒ Object



12
13
14
15
16
# File 'lib/retl/handlers/path_handler.rb', line 12

def call(data, context)
  @context.execute_step(@path, data).each do |result|
    push_out(result)
  end
end