Class: TableStructure::Schema::Table
- Inherits:
-
Object
- Object
- TableStructure::Schema::Table
- Defined in:
- lib/table_structure/schema/table.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ result_type: :array }.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.
-
#result_builders ⇒ Object
readonly
Returns the value of attribute result_builders.
Instance Method Summary collapse
- #header(context) ⇒ Object
-
#initialize(column_definitions, column_converters, result_builders, context, options) ⇒ Table
constructor
A new instance of Table.
- #row(context) ⇒ Object
Constructor Details
#initialize(column_definitions, column_converters, result_builders, context, options) ⇒ Table
Returns a new instance of Table.
10 11 12 13 14 15 16 |
# File 'lib/table_structure/schema/table.rb', line 10 def initialize(column_definitions, column_converters, result_builders, context, ) = DEFAULT_OPTIONS.merge() @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.
8 9 10 |
# File 'lib/table_structure/schema/table.rb', line 8 def column_converters @column_converters end |
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
8 9 10 |
# File 'lib/table_structure/schema/table.rb', line 8 def columns @columns end |
#result_builders ⇒ Object (readonly)
Returns the value of attribute result_builders.
8 9 10 |
# File 'lib/table_structure/schema/table.rb', line 8 def result_builders @result_builders end |
Instance Method Details
#header(context) ⇒ Object
18 19 20 |
# File 'lib/table_structure/schema/table.rb', line 18 def header(context) values(:name, context) end |
#row(context) ⇒ Object
22 23 24 |
# File 'lib/table_structure/schema/table.rb', line 22 def row(context) values(:value, context) end |