Deliverer
Any a web application needs the input filter.This gem help you protect your creature from XSS atacks and uncensored user communication (case web-application is forum).Differently it is your Deliverer from many,many problems..
Installation
Add this line to your application's Gemfile:
gem 'deliverer'
And then execute:
$ bundle
Or install it yourself as:
$ gem install deliverer
Methods
Forbid
Delete all selected words in filtering text. Just write them in function arguments.
(U may write so many argumentes as you need ) Every entrance every argumentes wil be deleted
Want learn more? See Usage -> Example_2
Censor
Replaces all selected words in filtering text 1st argument is word replaces 2nd,3rd etc argumentes
in text (U may write so many argumentes as you need ) And every entrance every argumentes(except 1st)
wil be replaced on value 1st argument. for example 1st argument may be - " [censored] " or
"[Observe censorship] " or " (-_-) " or just "".
Want learn more? See Usage -> Example_2
Usage
1.Example:
x - censor var
x.filter
Congratulation! Henceforth you protect from XSS
2.Example:
if you want to filter user communication on your forum just
give block for last method and use functions forbid and censor in it.
x.filter do |check|
check.forbid " fuck "," pecker "
check.censor "[censored]"," dick "
end
3.Example:
You may use one methods several times in block to code look normal.
It is ugly,isn`t it?
x.filter do |v|
v.censor "\[censored\]"," dick "," any not correct word "," any curse "," fucking admin ",
" 2nd not correct word "," 2 curse "," 3rd curse "
end
More better
x.filter do
censor "[censored]"," dick "," any not correct word "
censor "[censored]"," any curse "," fucking admin "
censor "[censored]"," 2nd not correct word "," 2 curse "
censor "[censored]"," 3rd curse "
end`
P.S. It would be beter if you`ll write forbid words beetwin spaces becourse it may be appear as part a normal word I mean:
1.- y r dick!
2.- in dicken`s cafe at 7pm
**after filtering(in example)**
1.- y r [censored]!
2.- in [censored]en`s cafe at 7 pm
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Added some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request