Module: CheckProfanity
- Defined in:
- lib/checkprofanity.rb
Class Method Summary collapse
Class Method Details
.filter(text) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/checkprofanity.rb', line 4 def self.filter(text) text_to_filter = text.dup @BAD_WORDS.each do |word| text_to_filter.gsub!(/\b#{word}\b/i, word[0,1]+ ("*"*(word.size-1))) end return text_to_filter end |