Class: ImportEverything::Parser
- Inherits:
-
Object
- Object
- ImportEverything::Parser
show all
- Includes:
- FromHash
- Defined in:
- lib/import_everything/parsers/parser.rb
Instance Method Summary
collapse
Instance Method Details
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_rows ⇒ Object
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_parsers ⇒ Object
24
|
# File 'lib/import_everything/parsers/parser.rb', line 24
def line_parsers; parsers; end
|
#table_rows_hash ⇒ Object
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
|