Class: Fluffix::US

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

Class Method Summary collapse

Class Method Details

.cleanse(text) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fluffix.rb', line 38

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