Class: TableStructure::Schema::RowContextBuilderFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/table_structure/schema/row_context_builder_factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(schema, builders) ⇒ RowContextBuilderFactory

Returns a new instance of RowContextBuilderFactory.



6
7
8
9
# File 'lib/table_structure/schema/row_context_builder_factory.rb', line 6

def initialize(schema, builders)
  @schema = schema
  @builders = builders
end

Instance Method Details

#create_data_builderObject



18
19
20
21
22
23
# File 'lib/table_structure/schema/row_context_builder_factory.rb', line 18

def create_data_builder
  return unless @schema.contain_value_callable?
  return unless @builders.key?(:row)

  proc { |context| @builders[:row].call(context) }
end

#create_header_builderObject



11
12
13
14
15
16
# File 'lib/table_structure/schema/row_context_builder_factory.rb', line 11

def create_header_builder
  return unless @schema.contain_name_callable?
  return unless @builders.key?(:header)

  proc { |context| @builders[:header].call(context) }
end