Class: Fluffix::US

Inherits:
Object
  • Object
show all
Defined in:
lib/fluffix.rb

Class Method Summary collapse

Class Method Details

.cleanse(text) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fluffix.rb', line 9

def self.cleanse(text)
  raise("Must quack like a string") unless text.respond_to?(:to_s)
  RULES.each do |rule|
    # should return the text in the original form and should handle / ignore punctuation
    if text =~ rule
      result = text.sub(rule, '')
      return result
    end
  end
  return text
end