Method: ActionView::Helpers::SanitizeHelper#strip_links
- Defined in:
- actionview/lib/action_view/helpers/sanitize_helper.rb
#strip_links(html) ⇒ Object
Strips all link tags from html
leaving just the link text.
strip_links('<a href="http://www.rubyonrails.org">Ruby on Rails</a>')
# => Ruby on Rails
strip_links('Please e-mail me at <a href="mailto:[email protected]">[email protected]</a>.')
# => Please e-mail me at [email protected].
strip_links('Blog: <a href="http://www.myblog.com/" class="nav" target=\"_blank\">Visit</a>.')
# => Blog: Visit.
strip_links('<<a href="https://example.org">malformed & link</a>')
# => <malformed & link
121 122 123 |
# File 'actionview/lib/action_view/helpers/sanitize_helper.rb', line 121 def strip_links(html) self.class.link_sanitizer.sanitize(html) end |