Class: Moderate::Text
- Inherits:
-
Object
- Object
- Moderate::Text
- Defined in:
- lib/moderate/text.rb
Class Method Summary collapse
Class Method Details
.bad_words?(text) ⇒ Boolean
6 7 8 9 10 11 |
# File 'lib/moderate/text.rb', line 6 def bad_words?(text) return false if text.blank? @words_set ||= Set.new(compute_word_list) text.downcase.split(/\W+/).any? { |word| @words_set.include?(word) } end |