Class: Dap::Filter::FilterSplitComma

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



417
418
419
420
421
422
423
424
425
426
427
# File 'lib/dap/filter/simple.rb', line 417

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