Class: Kiba::Extend::Utils::FingerprintCreator
- Inherits:
-
Object
- Object
- Kiba::Extend::Utils::FingerprintCreator
- Defined in:
- lib/kiba/extend/utils/fingerprint_creator.rb
Overview
Callable service to generate a fingerprint value from the given fields
Instance Method Summary collapse
-
#call(row) ⇒ Object
-
#initialize(fields:, delim:) ⇒ FingerprintCreator
constructor
A new instance of FingerprintCreator.
Constructor Details
#initialize(fields:, delim:) ⇒ FingerprintCreator
Returns a new instance of FingerprintCreator.
15 16 17 18 19 20 21 |
# File 'lib/kiba/extend/utils/fingerprint_creator.rb', line 15 def initialize(fields:, delim:) @fields = [fields].flatten @delim = delim @value_getter = Transforms::Helpers::FieldValueGetter.new( fields: fields, delim: delim, discard: [] ) end |
Instance Method Details
#call(row) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/kiba/extend/utils/fingerprint_creator.rb', line 26 def call(row) values = value_getter.call(row).values check_values(values) Base64.strict_encode64(hashable_values(values).join(delim)) end |