Class: RemoteTable::Format::FixedWidth

Inherits:
RemoteTable::Format show all
Includes:
Textual
Defined in:
lib/remote_table/format/fixed_width.rb

Constant Summary

Constants included from Textual

Textual::USELESS_CHARACTERS

Instance Attribute Summary

Attributes inherited from RemoteTable::Format

#t

Instance Method Summary collapse

Methods included from Textual

#convert_file_to_utf8!, #crop_rows!, #cut_columns!, #remove_useless_characters!, #skip_rows!

Methods inherited from RemoteTable::Format

#initialize

Constructor Details

This class inherits a constructor from RemoteTable::Format

Instance Method Details

#each(&blk) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/remote_table/format/fixed_width.rb', line 6

def each(&blk)
  convert_file_to_utf8!
  remove_useless_characters!
  crop_rows!
  skip_rows!
  cut_columns!
  parser.parse[:rows].each do |hash|
    hash.reject! { |k, v| k.blank? }
    yield hash if t.properties.keep_blank_rows or hash.any? { |k, v| v.present? }
  end
ensure
  t.local_file.delete
end