Class: ImportEverything::DisplayTable

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rowsObject

Returns the value of attribute rows.



3
4
5
# File 'lib/import_everything/preview.rb', line 3

def rows
  @rows
end

#tableObject

Returns the value of attribute table.



3
4
5
# File 'lib/import_everything/preview.rb', line 3

def table
  @table
end

Instance Method Details

#each_row_value_arrayObject



8
9
10
11
12
13
# File 'lib/import_everything/preview.rb', line 8

def each_row_value_array
  rows.each do |row|
    vals = keys.map { |k| row[k] }
    vals.each { |x| yield(x) }
  end
end

#row_value_arraysObject



14
15
16
17
18
# File 'lib/import_everything/preview.rb', line 14

def row_value_arrays
  rows.map do |row|
    keys.map { |k| row[k] }
  end
end

#to_hashObject



22
23
24
# File 'lib/import_everything/preview.rb', line 22

def to_hash
  {:keys => keys, :row_arrays => row_value_arrays, :table => table}
end