Module: CSVDecision::Parse Private
- Defined in:
- lib/csv_decision/parse.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.
Methods to parse the decision table and return CSVDecision::Table object.
Class Method Summary collapse
- .invalid_out_ref?(columns, index, in_out) ⇒ Boolean private
-
.table(data:, options:) ⇒ CSVDecision::Table
private
Parse the CSV file or input data and create a new decision table object.
Class Method Details
.invalid_out_ref?(columns, index, in_out) ⇒ Boolean
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.
181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/csv_decision/parse.rb', line 181 def self.invalid_out_ref?(columns, index, in_out) return false if in_out < index that_column = if in_out == index 'reference to itself' else "an out of order reference to output column '#{columns.outs[in_out].name}'" end raise CellValidationError, "output column '#{columns.outs[index].name}' makes #{that_column}" end |
.table(data:, options:) ⇒ CSVDecision::Table
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 CSV file or input data and create a new decision table object.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/csv_decision/parse.rb', line 54 def self.table(data:, options:) table = CSVDecision::Table.new # In most cases the decision table will be loaded from a CSV file. table.file = data if Data.input_file?(data) parse_table(table: table, input: data, options: ) # The table object is now immutable. table.columns.freeze table.freeze rescue CSVDecision::Error => exp raise_error(file: table.file, exception: exp) end |