Class: Dap::Filter::FilterSplitArray

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/dap/filter/simple.rb

Instance Attribute Summary

Attributes included from Base

#name, #opts

Instance Method Summary collapse

Methods included from Base

#initialize

Instance Method Details

#process(doc) ⇒ Object



432
433
434
435
436
437
438
439
440
441
442
# File 'lib/dap/filter/simple.rb', line 432

def process(doc)
  lines = [ ]
  self.opts.each_pair do |k,v|
    if doc.has_key?(k) and doc[k].respond_to?(:each)
      doc[k].each do |line|
        lines << doc.merge({ "#{k}.item" => line })
      end
    end
  end
 lines.length == 0 ? [ doc ] : [ lines ]
end