module CSVDecision

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details..

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers. See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers. See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers. See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers. See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers. See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

CSV Decision: CSV based Ruby decision tables. Created December 2017. @author Brett Vickers <brett@phillips-vickers.com> See LICENSE and README.md for details.

Constants

COMMENT_CHARACTER

All cells starting with this character are comments, and treated as a blank cell.

Public Class Methods

load(path, options = {}) click to toggle source

Load all the CSV files located in the designated folder path.

@param path [Pathname] Directory containing CSV decision table files. @param options (see CSVDecision.parse) @return [Hash{Symbol=><CSVDecision::Table>}] Hash of decision tables keyed by the CSV

file's symbolized base name.

@raise [ArgumentError] Invalid path name or folder.

# File lib/csv_decision/load.rb, line 15
def self.load(path, options = {})
  Load.path(path: path, options: options)
end
parse(data, options = {}) click to toggle source

Builds a decision table from the input data - which may either be a file, CSV string or an array of arrays.

@example Simple Example

If you have cloned the gem's git repo, then you can run:
table = CSVDecision.parse(Pathname('spec/data/valid/simple_example.csv'))
  #=> CSVDecision::Table
table.decide(topic: 'finance', region: 'Europe') #=> team_member: 'Donald'

@param data [Pathname, File, Array<Array<String>>, String] input data given as

a CSV file, array of arrays or CSV string.

@param options [Hash{Symbol=>Object}] Options hash controlling how the table is parsed and

interpreted.

@option options [Boolean] :first_match Stop scanning after finding the first row match. @option options [Boolean] :regexp_implicit Make regular expressions implicit rather than

requiring the comparator =~. (Use with care.)

@option options [Boolean] :text_only All cells treated as simple strings by turning off all

special matchers.

@option options [Array<Matchers::Matcher>] :matchers May be used to control the inclusion and

ordering of special matchers. (Advanced feature, use with care.)

@return [CSVDecision::Table] Resulting decision table.

@raise [CSVDecision::CellValidationError] Table parsing cell validation error. @raise [CSVDecision::FileError] Table parsing error for a named CSV file.

# File lib/csv_decision/parse.rb, line 47
def self.parse(data, options = {})
  Parse.table(data: data, options: Options.normalize(options))
end
root() click to toggle source

@return [String] gem project's root directory

# File lib/csv_decision.rb, line 12
def self.root
  File.dirname __dir__
end