Skip to content

Instantly share code, notes, and snippets.

@jk195417
Last active June 6, 2021 02:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jk195417/298a359ddcac3e9e6a229bd85fd3824d to your computer and use it in GitHub Desktop.
Save jk195417/298a359ddcac3e9e6a229bd85fd3824d to your computer and use it in GitHub Desktop.
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