Class: TableStructure::Schema::Table
- Inherits:
-
Object
- Object
- TableStructure::Schema::Table
- Defined in:
- lib/table_structure/schema/table.rb
Instance Method Summary collapse
- #body(items) ⇒ Object
- #header(context: nil) ⇒ Object
-
#initialize(columns:, context:, keys_generator:) ⇒ Table
constructor
A new instance of Table.
- #row(context: nil) ⇒ Object
- #rows(items) ⇒ Object
Constructor Details
#initialize(columns:, context:, keys_generator:) ⇒ Table
Returns a new instance of Table.
6 7 8 9 10 11 12 13 14 |
# File 'lib/table_structure/schema/table.rb', line 6 def initialize( columns:, context:, keys_generator: ) @columns = columns @context = context @keys_generator = keys_generator end |
Instance Method Details
#body(items) ⇒ Object
25 26 27 28 29 |
# File 'lib/table_structure/schema/table.rb', line 25 def body(items) Enumerator.new do |y| items.each { |item| y << data(context: item) } end end |
#header(context: nil) ⇒ Object
16 17 18 |
# File 'lib/table_structure/schema/table.rb', line 16 def header(context: nil) row_values(:names, context) end |
#row(context: nil) ⇒ Object
20 21 22 23 |
# File 'lib/table_structure/schema/table.rb', line 20 def row(context: nil) warn '[TableStructure] `TableStructure::Schema::Table#row(context:)` has been deprecated. Use `TableStructure::Schema::Table#body(items)` instead.' data(context: context) end |
#rows(items) ⇒ Object
31 32 33 34 |
# File 'lib/table_structure/schema/table.rb', line 31 def rows(items) warn '[TableStructure] `TableStructure::Schema::Table#rows(items)` has been deprecated. Use `TableStructure::Schema::Table#body(items)` instead.' body(items) end |