Class: Dap::Filter::FilterFieldSplitComma

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



312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/dap/filter/simple.rb', line 312

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