Created
November 10, 2016 18:50
-
-
Save leandroh/7a22ba4af195195202a451f7e17e1631 to your computer and use it in GitHub Desktop.
Strips all HTML tags in Ruby
This file contains hidden or 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
class String | |
def strip_tags | |
self.gsub(/<\/?[^>]*>/, '') if self | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment