README.md in obscenity-1.0.0 vs README.md in obscenity-1.0.1
- old
+ new
@@ -1,6 +1,6 @@
-# Obscenity [![Build Status](http://travis-ci.org/tjackiw/obscenity.png)](http://travis-ci.org/tjackiw/obscenity)
+# Obscenity [![Build Status](https://secure.travis-ci.org/tjackiw/obscenity.png)](http://travis-ci.org/tjackiw/obscenity)
Obscenity is a profanity filter gem for Ruby/Rubinius, Rails (through ActiveModel), and Rack middleware.
## Installation
@@ -50,10 +50,11 @@
- :default : Uses the :garbled method
- :garbled : Replaces profane words with $@!#%
- :stars : Replaces profane words with '*' up to the word's length
- :vowels : Replaces the vowels in the profane word with '*'
+- :nonconsonants : Replaces non consonants with '*'
- "custom string" : Replaces the profane word with the custom string
Example:
```ruby
@@ -99,10 +100,13 @@
=> "text with ****"
Obscenity.replacement(:vowels).sanitize("text with shit")
=> "text with sh*t"
+Obscenity.replacement(:nonconsonants).sanitize('Oh 5hit')
+=> "Oh *h*t"
+
Obscenity.replacement("[censored]").sanitize("text with shit")
=> "text with [censored]"
```
`Obscenity.offensive(text)` returns an array of profane words in the given content:
@@ -256,9 +260,20 @@
# Sanitizes the given params and replaces their values using a custom word
use Rack::Obscenity, sanitize: { params: [:foo, :bar], replacement: "[censored]" }
# Sanitizes all params and replaces their values using :garbled
use Rack::Obscenity, sanitize: { replacement: :garbled }
+```
+### Test Helpers
+
+Obscenity currently provides test helpers for RSpec only, but we have plans to add helpers to Shoulda as well.
+
+#### RSpec Matcher
+
+A `be_profane` matcher is available for RSpec. Its usage is very simple:
+
+```ruby
+user.username.should_not be_profane
```
## Contributing to obscenity
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.