Class: CSVDecision::Scan::InputHashes Private
- Inherits:
-
Object
- Object
- CSVDecision::Scan::InputHashes
- Defined in:
- lib/csv_decision/scan.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Derive the parsed input hash, using a cache for speed.
Instance Method Summary collapse
-
#data(table:, path:, input:) ⇒ Hash{Symbol=>Object}
private
Parsed input hash.
-
#initialize ⇒ InputHashes
constructor
private
A new instance of InputHashes.
Constructor Details
#initialize ⇒ InputHashes
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.
Returns a new instance of InputHashes
71 72 73 |
# File 'lib/csv_decision/scan.rb', line 71 def initialize @input_hashes = {} end |
Instance Method Details
#data(table:, path:, input:) ⇒ Hash{Symbol=>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.
Returns Parsed input hash.
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/csv_decision/scan.rb', line 78 def data(table:, path:, input:) return @input_hashes[path] if @input_hashes.key?(path) # Use the path - an array of symbol keys, to dig out the input sub-hash hash = path.empty? ? input : input.dig(*path) # Parse and transform the hash supplied as input data = hash.blank? ? {} : Input.parse_data(table: table, input: hash) # Cache the parsed input hash data for this path @input_hashes[path] = data end |