Module: Cleaners::CompressWhitespace
- Defined in:
- lib/data_cleansing/cleaners.rb
Overview
Compress multiple whitespace to a single space
Constant Summary collapse
- WHITESPACE =
Regexp.compile(/\s+/)
Class Method Summary collapse
Class Method Details
.call(string) ⇒ Object
108 109 110 111 112 |
# File 'lib/data_cleansing/cleaners.rb', line 108 def self.call(string) return string unless string.is_a?(String) string.gsub!(WHITESPACE, ' ') || string end |