Module: ImportEverything::IterationHelpers
- Defined in:
- lib/import_everything/parser/parser.rb
Instance Method Summary collapse
Instance Method Details
#each_row ⇒ Object
35 36 37 38 39 |
# File 'lib/import_everything/parser/parser.rb', line 35 def each_row each_table_and_rows do |table,rows| rows.each { |row| yield(table,row) } end end |
#each_table_and_rows ⇒ Object
40 41 42 43 44 45 |
# File 'lib/import_everything/parser/parser.rb', line 40 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 |
#table_rows_hash ⇒ Object
46 47 48 49 50 |
# File 'lib/import_everything/parser/parser.rb', line 46 def table_rows_hash res = {} each_table_and_rows { |table,rows| res[table] = rows } res end |