Class: Kiba::Extend::Transforms::Clean::DowncaseFieldValues
- Inherits:
-
Object
- Object
- Kiba::Extend::Transforms::Clean::DowncaseFieldValues
- Defined in:
- lib/kiba/extend/transforms/clean.rb
Instance Method Summary collapse
-
#initialize(fields:) ⇒ DowncaseFieldValues
constructor
A new instance of DowncaseFieldValues.
-
#process(row) ⇒ Object
Constructor Details
#initialize(fields:) ⇒ DowncaseFieldValues
Returns a new instance of DowncaseFieldValues.
200 201 202 |
# File 'lib/kiba/extend/transforms/clean.rb', line 200 def initialize(fields:) @fields = [fields].flatten end |
Instance Method Details
#process(row) ⇒ Object
205 206 207 208 209 210 211 |
# File 'lib/kiba/extend/transforms/clean.rb', line 205 def process(row) @fields.each do |field| val = row.fetch(field) row[field] = val.is_a?(String) ? val.downcase : val end row end |