Class: ActiveCleaner::StringCleaner
- Inherits:
-
BaseCleaner
- Object
- BaseCleaner
- ActiveCleaner::StringCleaner
- Defined in:
- lib/active_cleaner/string_cleaner.rb
Instance Attribute Summary
Attributes inherited from BaseCleaner
Instance Method Summary collapse
Methods inherited from BaseCleaner
#==, #clean, #initialize, kind, #kind, #nilify_value?
Constructor Details
This class inherits a constructor from ActiveCleaner::BaseCleaner
Instance Method Details
#clean_value(old_value, record = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/active_cleaner/string_cleaner.rb', line 6 def clean_value(old_value, record=nil) unless old_value.nil? value = old_value.dup value.strip! value.gsub!(/\s+/, " ") value end end |