Class: YamlDb::Dump
Class Method Summary
collapse
after_table, base_tables, before_table, dump, dump_table, each_table_page, table_column_names, table_record_count, tables
Class Method Details
.dump_table_columns(io, table) ⇒ Object
36
37
38
39
|
# File 'lib/ironmine_yaml_db.rb', line 36
def self.dump_table_columns(io, table)
io.write("\n")
io.write({ table => { 'columns' => table_column_names(table) } }.to_yaml)
end
|
.dump_table_records(io, table) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/ironmine_yaml_db.rb', line 41
def self.dump_table_records(io, table)
(io)
column_names = {}
ActiveRecord::Base.connection.columns(table).each do |c|
column_names[c.name] = c.null
end
each_table_page(table) do |records|
rows = SerializationHelper::Utils.unhash_records(records, column_names)
io.write(YamlDb::Utils.chunk_records(records))
end
end
|
53
54
55
|
# File 'lib/ironmine_yaml_db.rb', line 53
def self.(io)
io.write(" records: \n")
end
|