Class: TableStructure::Schema::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/table_structure/schema/table.rb,
lib/table_structure/schema/table/key_decorator.rb

Defined Under Namespace

Classes: KeyDecorator

Constant Summary collapse

DEFAULT_OPTIONS =
{
  result_type: :array
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(columns, context, options) ⇒ Table

Returns a new instance of Table.



10
11
12
13
14
15
16
17
18
# File 'lib/table_structure/schema/table.rb', line 10

def initialize(
  columns,
  context,
  options
)
  @columns = columns
  @context = context
  @options = DEFAULT_OPTIONS.merge(options)
end

Instance Method Details

#header(context: nil) ⇒ Object



20
21
22
# File 'lib/table_structure/schema/table.rb', line 20

def header(context: nil)
  values(:name, context)
end

#row(context: nil) ⇒ Object



24
25
26
# File 'lib/table_structure/schema/table.rb', line 24

def row(context: nil)
  values(:value, context)
end