Last active
June 6, 2021 02:23
-
-
Save jk195417/298a359ddcac3e9e6a229bd85fd3824d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def content_filter(content) | |
# remove url | |
content = content.gsub(URI::DEFAULT_PARSER.make_regexp(['http', 'https']), '') | |
# remove mentions | |
content = content.gsub(/[bB]\d+/, '') | |
# check not empty content | |
raise 'no content' if content.blank? | |
return content | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment