Class: Humr::Splitter::LTSV

Inherits:
Object
  • Object
show all
Defined in:
lib/humr/splitter/ltsv.rb

Instance Method Summary collapse

Instance Method Details

#sub_each_field(line, &block) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/humr/splitter/ltsv.rb', line 6

def sub_each_field(line, &block)
  index = 0
  line.gsub(/([0-9A-Za-z_.-]+:)([^\t]+)/) do |field|
    index += 1
    "#{$1}#{yield($2, index)}"
  end
end