Hey devs ✌️,
At stanza.dev we help developers to share coding concepts and learn from each others. 👨💻 👩💻
We can't monitor each post by hand but as Stanza must be a place full of love 🌞, we have developed a gem that removes the bad words from the website : polite_text
include PoliteText str = "This gem is a fucking big shit but let's try it" PoliteText.be_polite!(str) => "This gem is a *** big *** but let's try it"
include PoliteText str = "This gem is a fucking big shit but let's try it" PoliteText.is_polite?(str) => false
# == Schema Information # # Table name: articles # # id :bigint not null, primary key # text :string default(""), not null # created_at :datetime not null # updated_at :datetime not null # class Article < ApplicationRecord include PoliteText # Callbacks before_save :make_text_polite # Methods def make_text_polite PoliteText.be_polite!(text) end end
You can even pass your custom swear words list that is relevant for your app.
We have opensourced it and we hope that you will like it and contribute to improve it if you want 🙏
👉 stanza.dev - Learn coding concepts faster
Access the gem repo here