Module: MrClean::Filter

Defined in:
lib/mr_clean/filter.rb

Constant Summary collapse

NON_WORDS =
/(?!\s|-)\W|\d|_/
ONE_SPACE_STRING =
' '
EMPTY_STRING =
''

Class Method Summary collapse

Class Method Details

.clean(text) ⇒ Object



9
10
11
# File 'lib/mr_clean/filter.rb', line 9

def clean(text)
  text.downcase.gsub(NON_WORDS, EMPTY_STRING)
end

.slice(text) ⇒ Object



13
14
15
# File 'lib/mr_clean/filter.rb', line 13

def slice(text)
  clean(text).split(ONE_SPACE_STRING)
end