Module: Forspell::Sanitizer

Defined in:
lib/forspell/sanitizer.rb

Constant Summary collapse

REMOVE_PUNCT =
%r{[!|?|,|(|)|"|;]+}.freeze

Class Method Summary collapse

Class Method Details

.sanitize(input) ⇒ Object



10
11
12
13
14
# File 'lib/forspell/sanitizer.rb', line 10

def self.sanitize(input)

CGI.unescapeHTML(Sanitize.fragment(input, elements: [], remove_contents: true))
   .gsub(REMOVE_PUNCT, '').gsub(%r{[.:]+$}, '')
end