Class: ImportEverything::Parser

Inherits:
Object
  • Object
show all
Includes:
FromHash
Defined in:
lib/import_everything/parsers/parser.rb

Instance Method Summary collapse

Instance Method Details

#each_rowObject



29
30
31
32
33
# File 'lib/import_everything/parsers/parser.rb', line 29

def each_row
  each_table_and_rows do |table,rows|
    rows.each { |row| yield(table,row) }
  end
end

#each_table_and_rowsObject



34
35
36
37
38
39
# File 'lib/import_everything/parsers/parser.rb', line 34

def each_table_and_rows
  cleaned_row_hashes.group_by { |x| x[:table] }.each do |table,rows|
    values = rows.map { |x| x[:values] }
    yield(table,values)
  end
end

#line_parsersObject



24
# File 'lib/import_everything/parsers/parser.rb', line 24

def line_parsers; parsers; end

#table_rows_hashObject



40
41
42
43
44
# File 'lib/import_everything/parsers/parser.rb', line 40

def table_rows_hash
  res = {}
  each_table_and_rows { |table,rows| res[table] = rows }
  res
end