Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/liquid_markdown/core_ext/string/strip.rb
Instance Method Summary collapse
-
#strip_html_tags ⇒ Object
Returns a new string after stripping all html tags.
Instance Method Details
#strip_html_tags ⇒ Object
Returns a new string after stripping all html tags
string = "<hello>threre</hello>"
string. => "there"
7 8 9 10 11 12 13 14 |
# File 'lib/liquid_markdown/core_ext/string/strip.rb', line 7 def empty = ''.freeze self.to_s .gsub(/<script.*?<\/script>/m, empty) .gsub(/<!--.*?-->/m, empty) .gsub(/<style.*?<\/style>/m, empty) .gsub(/<.*?>/m, empty) end |