Class: Dap::Filter::FilterFieldSplit

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



447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/dap/filter/simple.rb', line 447

def process(doc)
  self.opts.each_pair do |k,v|
    if doc.has_key?(k)
      count = 1
      doc[k].to_s.split(Regexp.new(v)).each do |thing|
        doc.merge!({ "#{k}.f#{count}" => thing })
        count += 1
      end
    end
  end
 [ doc ]
end