Class: Kiba::Extend::Utils::Lookup::RowSelectorByHash
- Inherits:
-
Object
- Object
- Kiba::Extend::Utils::Lookup::RowSelectorByHash
- Defined in:
- lib/kiba/extend/utils/lookup/row_selector_by_hash.rb
Overview
:field_equal is an array of 2-element arrays to be compared. The whole value of the first field/string must match the whole value of the second field/string The elements in the pairwise arrays follow these formats: ‘row::fieldname’ - field from workng row whose value should be compared ‘mergerow::fieldname’ - field from merge row whose value(s) should be compared ‘value::string’ - string against which to compare a field value ‘revalue::string’ - string to be compared as a regular expression against a field value It is assumed, but not enforced, that at least one of the pair will be a field
Instance Method Summary collapse
-
#call(origrow:, mergerows:) ⇒ Object
-
#initialize(conditions: {}, sep: nil) ⇒ RowSelectorByHash
constructor
A new instance of RowSelectorByHash.
-
#result ⇒ Object
Constructor Details
#initialize(conditions: {}, sep: nil) ⇒ RowSelectorByHash
Returns a new instance of RowSelectorByHash.
21 22 23 24 25 26 27 |
# File 'lib/kiba/extend/utils/lookup/row_selector_by_hash.rb', line 21 def initialize(conditions: {}, sep: nil) @conditions = conditions @sep = sep @toexclude = conditions[:exclude] @toinclude = conditions[:include] end |
Instance Method Details
#call(origrow:, mergerows:) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/kiba/extend/utils/lookup/row_selector_by_hash.rb', line 29 def call(origrow:, mergerows:) rowset = mergerows.empty? ? [origrow] : mergerows with_exclusions = do_exclusions(origrow, rowset) narrowed = get_first(with_exclusions) do_inclusions(origrow, narrowed) end |
#result ⇒ Object
36 37 38 |
# File 'lib/kiba/extend/utils/lookup/row_selector_by_hash.rb', line 36 def result keeprows end |