Module: CSVDecision2::Defaults Private

Defined in:
lib/csv_decision2/defaults.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Parse the default row beneath the header row if present

Class Method Summary collapse

Class Method Details

.parse(columns:, matchers:, row:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parse the defaults row that (optionally) appears just after the header row. We have already determined that this row must be present.

Parameters:

  • columns ({Integer=>Dictionary::Entry})

    Hash of header columns with defaults.

  • matchers (Array<Matchers>)

    Output cell special matchers.

  • row (Array<String>)

    Defaults row that appears just after the header row.

Raises:



17
18
19
20
21
22
23
24
25
26
# File 'lib/csv_decision2/defaults.rb', line 17

def self.parse(columns:, matchers:, row:)
  raise TableValidationError, 'Missing defaults row' if row.nil?

  defaults = columns.defaults

  # Scan the default row for procs and constants
  scan_row = ScanRow.new.scan_columns(row: row, columns: defaults, matchers: matchers)

  parse_columns(defaults: defaults, columns: columns.dictionary, row: scan_row)
end