Class: Kiba::Extend::Transforms::Cspace::ConvertToID
- Inherits:
-
Object
- Object
- Kiba::Extend::Transforms::Cspace::ConvertToID
- Defined in:
- lib/kiba/extend/transforms/cspace/convert_to_id.rb
Instance Method Summary collapse
-
#initialize(source:, target:) ⇒ ConvertToID
constructor
A new instance of ConvertToID.
-
#process(row) ⇒ Object
Constructor Details
#initialize(source:, target:) ⇒ ConvertToID
Returns a new instance of ConvertToID.
8 9 10 11 |
# File 'lib/kiba/extend/transforms/cspace/convert_to_id.rb', line 8 def initialize(source:, target:) @source = source @target = target end |
Instance Method Details
#process(row) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/kiba/extend/transforms/cspace/convert_to_id.rb', line 14 def process(row) val = row.fetch(@source, "") idval = val.gsub(/\W/, "") row[@target] = "#{idval}#{XXhash.xxh32(idval)}" row end |