Class: PiecePipe::DebugStep

Inherits:
Step
  • Object
show all
Defined in:
lib/piece_pipe/debug_step.rb

Instance Attribute Summary

Attributes inherited from Step

#source

Instance Method Summary collapse

Methods inherited from Step

#to_enum

Constructor Details

#initialize(opts = {}, &block) ⇒ DebugStep

Returns a new instance of DebugStep.



3
4
5
6
# File 'lib/piece_pipe/debug_step.rb', line 3

def initialize(opts={},&block)
  @opts = opts
  @block = block
end

Instance Method Details

#process(item) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/piece_pipe/debug_step.rb', line 8

def process(item)
  title = @opts[:title] || "DEBUG:" 
  if @opts[:inspect_keys]
    puts "#{title} #{item.slice(*@opts[:inspect_keys])}"
  end
  @block.call if @block
  produce item
end