Sauber
A tiny profanity filter.
Installation
Add this line to your application's Gemfile:
gem 'sauber'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sauber
Usage
Sauber.configure do |config|
config.blacklist = ["bad", "crime", "war"]
config.whitelist = ["peace"]
config.replacement = :stars
end
Blacklist
Words or phrases that you would like to remove.
config.whitelist
accepts the following values:
- An array with words
- A string representing a path to a yml file
Whitelist
Phrases that contain a word from the blacklist that you don't wish to remove.
config.blacklist
accepts the following values:
- An array with words
- A string representing a path to a yml file
Replacement
config.replacement
accepts the following values:
- :stars : Replaces profane words with '*' up to the word's length
Basic Usage
Sauber.clean("simple text")
=> "simple text"
Sauber.clean("text with shit")
=> "text with ****"
Contributing
- Fork it ( https://github.com/[my-github-username]/sauber/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request