Class: YamlDb::Dump
- Inherits:
-
SerializationHelper::Dump
- Object
- SerializationHelper::Dump
- YamlDb::Dump
- Defined in:
- lib/yaml_db.rb
Class Method Summary collapse
- .dump_table_columns(io, table) ⇒ Object
- .dump_table_records(io, table) ⇒ Object
- .table_record_header(io) ⇒ Object
Class Method Details
.dump_table_columns(io, table) ⇒ Object
37 38 39 40 |
# File 'lib/yaml_db.rb', line 37 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
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/yaml_db.rb', line 42 def self.dump_table_records(io, table) table_record_header(io) column_names = table_column_names(table) each_table_page(table) do |records| rows = SerializationHelper::Utils.unhash_records(records.to_a, column_names) io.write(Utils.chunk_records(rows)) end end |
.table_record_header(io) ⇒ Object
53 54 55 |
# File 'lib/yaml_db.rb', line 53 def self.table_record_header(io) io.write(" records: \n") end |