Method: Cucumber::MultilineArgument::DataTable#initialize

Defined in:
lib/cucumber/multiline_argument/data_table.rb

#initialize(data, conversion_procs = NULL_CONVERSIONS.dup, header_mappings = {}, header_conversion_proc = nil) ⇒ DataTable

Returns a new instance of DataTable.

Parameters:

  • data (Core::Test::DataTable)

    the data for the table

  • conversion_procs (Hash) (defaults to: NULL_CONVERSIONS.dup)

    see map_column

  • header_mappings (Hash) (defaults to: {})

    see map_headers

  • header_conversion_proc (Proc) (defaults to: nil)

    see map_headers

Raises:

  • (ArgumentError)


86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/cucumber/multiline_argument/data_table.rb', line 86

def initialize(data, conversion_procs = NULL_CONVERSIONS.dup, header_mappings = {}, header_conversion_proc = nil)
  raise ArgumentError, 'data must be a Core::Test::DataTable' unless data.is_a? Core::Test::DataTable

  ast_table = data
  # Verify that it's square
  ast_table.transpose
  @cell_matrix = create_cell_matrix(ast_table)
  @conversion_procs = conversion_procs
  @header_mappings = header_mappings
  @header_conversion_proc = header_conversion_proc
  @ast_table = ast_table
end