Module: Saintly

Defined in:
lib/saintly.rb

Defined Under Namespace

Modules: Rails

Constant Summary collapse

VERSION =
"0.1.10"

Class Method Summary collapse

Class Method Details

.sanitize(text) ⇒ Object



4
5
6
7
8
# File 'lib/saintly.rb', line 4

def self.sanitize(text)
  return if text.nil?
  r = Regexp.new('^(' + ALLOWED_WORDS.join('|') + ')$')
  text.gsub(exclude_regex){|m| r.match(m).nil? ? '*' * m.length : m }
end