lib/etl/parser/fixed_width_parser.rb in activewarehouse-etl-0.3.0 vs lib/etl/parser/fixed_width_parser.rb in activewarehouse-etl-0.4.0
- old
+ new
@@ -14,10 +14,15 @@
# Return each row
def each
Dir.glob(file).each do |file|
open(file).each do |line|
row = {}
+ lines_skipped = 0
fields.each do |name, f|
+ if lines_skipped < source.skip_lines
+ lines_skipped += 1
+ next
+ end
# TODO make strip optional?
row[name] = convert(name, line[f.field_start, f.field_length].strip, f.type)
end
yield row
end
\ No newline at end of file