Module: Cleaners::RemoveNonPrintable

Defined in:
lib/data_cleansing/cleaners.rb

Overview

Remove all not printable characters

Constant Summary collapse

NOT_PRINTABLE =
Regexp.compile(/[^[:print:]]/)

Class Method Summary collapse

Class Method Details

.call(string) ⇒ Object



49
50
51
52
53
# File 'lib/data_cleansing/cleaners.rb', line 49

def self.call(string)
  return string unless string.is_a?(String)

  string.gsub!(NOT_PRINTABLE, '') || string
end