This version is not compatible with previous versions. The following are main changes and migration guide:
-
Keyword parameter
strictness
for bothprofane?
andprofanity_count
is replaced bystrategies
.# 'strict mode' before pf.profane?('text', strictness: :strict) # 'strict mode' now pf.profane?('text', strategies: :all) # 'tolerant mode' before pf.profane?('text', strictness: :tolerant) # 'tolerant mode' now pf.profane?('text', strategies: :basic)
-
We can compose our own strategies:
# the below two are exactly the same: pf.profane?('text', strategies: [:leet, :allow_symbol, :duplicate_characters, :partial_match]) pf.profane?('text', strategies: :all)
-
Now the default mode has full support for partial match
# before it passes our filter, but now it's marked as profane. pf.profane?('youasshole')
That's it. Enjoy!