instance method
links
Ruby on Rails 7.2.3
Since v6.0.6Signature
links()
Extracts links from the HTML fragment:
html = '<a href="http://example.com/">Example</a>' content = ActionText::Content.new(html) content.links # => ["http://example.com/"]
Source
# File actiontext/lib/action_text/content.rb, line 55
def links
@links ||= fragment.find_all("a[href]").map { |a| a["href"] }.uniq
end
Defined in actiontext/lib/action_text/content.rb line 55
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionText::Content