Class: TableStructure::Schema::Table
- Inherits:
-
Object
- Object
- TableStructure::Schema::Table
- Defined in:
- lib/table_structure/schema/table.rb
Instance Attribute Summary collapse
-
#column_converters ⇒ Object
readonly
Returns the value of attribute column_converters.
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#result_builders ⇒ Object
readonly
Returns the value of attribute result_builders.
Instance Method Summary collapse
- #header_values(context) ⇒ Object
-
#initialize(column_definitions, column_converters, result_builders, context, options) ⇒ Table
constructor
A new instance of Table.
- #keys ⇒ Object
- #row_values(context) ⇒ Object
Constructor Details
#initialize(column_definitions, column_converters, result_builders, context, options) ⇒ Table
Returns a new instance of Table.
8 9 10 11 12 13 14 |
# File 'lib/table_structure/schema/table.rb', line 8 def initialize(column_definitions, column_converters, result_builders, context, ) @columns = build_columns(column_definitions, context, ) @column_converters = default_column_converters.merge(column_converters) @result_builders = default_result_builders().merge(result_builders) @context = context = end |
Instance Attribute Details
#column_converters ⇒ Object (readonly)
Returns the value of attribute column_converters.
6 7 8 |
# File 'lib/table_structure/schema/table.rb', line 6 def column_converters @column_converters end |
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
6 7 8 |
# File 'lib/table_structure/schema/table.rb', line 6 def columns @columns end |
#result_builders ⇒ Object (readonly)
Returns the value of attribute result_builders.
6 7 8 |
# File 'lib/table_structure/schema/table.rb', line 6 def result_builders @result_builders end |
Instance Method Details
#header_values(context) ⇒ Object
16 17 18 |
# File 'lib/table_structure/schema/table.rb', line 16 def header_values(context) values(:name, context) end |
#keys ⇒ Object
24 25 26 |
# File 'lib/table_structure/schema/table.rb', line 24 def keys @columns.map(&:key).flatten end |
#row_values(context) ⇒ Object
20 21 22 |
# File 'lib/table_structure/schema/table.rb', line 20 def row_values(context) values(:value, context) end |