Class: Kiba::Extend::Transforms::Explode::RowsFromMultivalField
- Inherits:
-
Object
- Object
- Kiba::Extend::Transforms::Explode::RowsFromMultivalField
- Defined in:
- lib/kiba/extend/transforms/explode/rows_from_multival_field.rb
Overview
Splits given field value on given delimiter. Original row is removed. One new row per split value is added. Value of split field is one of the split values per row. All other values in row are left the same
Instance Method Summary collapse
-
#initialize(field:, delim: nil) ⇒ RowsFromMultivalField
constructor
A new instance of RowsFromMultivalField.
-
#process(row) ⇒ Object
Constructor Details
#initialize(field:, delim: nil) ⇒ RowsFromMultivalField
Returns a new instance of RowsFromMultivalField.
55 56 57 58 59 |
# File 'lib/kiba/extend/transforms/explode/rows_from_multival_field.rb', line 55 def initialize(field:, delim: nil) @exploder = RowsFromGroupedMultivalFields.new( fields: field, delim: delim ) end |
Instance Method Details
#process(row) ⇒ Object
62 63 64 |
# File 'lib/kiba/extend/transforms/explode/rows_from_multival_field.rb', line 62 def process(row) exploder.process(row) { |r| yield r } end |