Class: Kiba::Extend::Transforms::Clean::StripFields
- Inherits:
-
Object
- Object
- Kiba::Extend::Transforms::Clean::StripFields
- Includes:
- Allable
- Defined in:
- lib/kiba/extend/transforms/clean/strip_fields.rb
Overview
Removes all leading/trailing spaces from values in the specified fields.
Instance Method Summary collapse
-
#initialize(fields:, delim: nil) ⇒ StripFields
constructor
A new instance of StripFields.
-
#process(row) ⇒ Object
Constructor Details
#initialize(fields:, delim: nil) ⇒ StripFields
Returns a new instance of StripFields.
61 62 63 64 |
# File 'lib/kiba/extend/transforms/clean/strip_fields.rb', line 61 def initialize(fields:, delim: nil) @fields = [fields].flatten @delim = delim end |
Instance Method Details
#process(row) ⇒ Object
67 68 69 70 71 72 |
# File 'lib/kiba/extend/transforms/clean/strip_fields.rb', line 67 def process(row) finalize_fields(row) fields.each { |field| strip_field(field, row) } row end |