Module: RemoteTable::FixedWidth

Defined in:
lib/remote_table/file/fixed_width.rb

Instance Method Summary collapse

Instance Method Details

#each_row(&block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/remote_table/file/fixed_width.rb', line 3

def each_row(&block)
  backup_file!
  convert_file_to_utf8!
  remove_useless_characters!
  crop_rows!
  skip_rows!
  cut_columns!
  a = Slither.parse(path, schema_name)
  a[:rows].each do |hash|
    hash.reject! { |k, v| k.blank? }
    yield hash if keep_blank_rows or hash.any? { |k, v| v.present? }
  end
ensure
  restore_file!
end