mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-04-04 05:33:22 -04:00
17 lines
397 B
Ruby
17 lines
397 B
Ruby
# Helper module to clean the incoming data from CSV fields
|
|
class BikeCsvImporter
|
|
module Cleaner
|
|
def clean_value(value)
|
|
value_or_nil strip_value(value)
|
|
end
|
|
|
|
def strip_value(value)
|
|
value.try(:strip).try(:gsub, /\n|\r/, '')
|
|
end
|
|
|
|
def value_or_nil(value)
|
|
return value unless ['?', 'n/a', 'missing', 'unknown', ''].include? value.try(:downcase)
|
|
end
|
|
end
|
|
end
|