mirror of https://github.com/fspc/BikeShed-1.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
397 B
16 lines
397 B
# 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
|
|
|