Class: TableStructure::Schema::Table
- Inherits:
-
Object
- Object
- TableStructure::Schema::Table
- Defined in:
- lib/table_structure/schema/table.rb
Constant Summary collapse
- RESULT_BUILDERS =
{ hash: ->(values, keys, *) { keys.zip(values).to_h } }.freeze
Instance Attribute Summary collapse
-
#column_converters ⇒ Object
readonly
Returns the value of attribute column_converters.
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#result_builders ⇒ Object
readonly
Returns the value of attribute result_builders.
Instance Method Summary collapse
-
#header_values(context, result_type = nil) ⇒ Object
TODO.
-
#initialize(column_definitions, column_converters, result_builders, context, options) ⇒ Table
constructor
A new instance of Table.
- #keys ⇒ Object
-
#row_values(context, result_type = nil) ⇒ Object
TODO.
Constructor Details
#initialize(column_definitions, column_converters, result_builders, context, options) ⇒ Table
Returns a new instance of Table.
12 13 14 15 16 17 18 |
# File 'lib/table_structure/schema/table.rb', line 12 def initialize(column_definitions, column_converters, result_builders, context, ) @columns = build_columns(column_definitions, context, ) @column_converters = column_converters @result_builders = result_builders @context = context = end |
Instance Attribute Details
#column_converters ⇒ Object (readonly)
Returns the value of attribute column_converters.
10 11 12 |
# File 'lib/table_structure/schema/table.rb', line 10 def column_converters @column_converters end |
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
10 11 12 |
# File 'lib/table_structure/schema/table.rb', line 10 def columns @columns end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/table_structure/schema/table.rb', line 10 def end |
#result_builders ⇒ Object (readonly)
Returns the value of attribute result_builders.
10 11 12 |
# File 'lib/table_structure/schema/table.rb', line 10 def result_builders @result_builders end |
Instance Method Details
#header_values(context, result_type = nil) ⇒ Object
TODO
20 21 22 |
# File 'lib/table_structure/schema/table.rb', line 20 def header_values(context, result_type = nil) # TODO values(:name, result_type, context) end |
#keys ⇒ Object
28 29 30 |
# File 'lib/table_structure/schema/table.rb', line 28 def keys @keys ||= @columns.map(&:key).flatten end |
#row_values(context, result_type = nil) ⇒ Object
TODO
24 25 26 |
# File 'lib/table_structure/schema/table.rb', line 24 def row_values(context, result_type = nil) # TODO values(:value, result_type, context) end |