Class: Dap::Filter::FilterFieldSplitTab

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



296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/dap/filter/simple.rb', line 296

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