Class: ReeText::StripLinks

Inherits:
Object
  • Object
show all
Includes:
Ree::FnDSL
Defined in:
lib/ree_lib/packages/ree_text/package/ree_text/functions/strip_links.rb

Constant Summary collapse

DEFAULTS =
{
  tags: Set.new(%w(a)),
  attributes: Set.new(%w(href))
}.freeze

Instance Method Summary collapse

Instance Method Details

#call(html) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/ree_lib/packages/ree_text/package/ree_text/functions/strip_links.rb', line 23

def call(html)
  link_scrubber = TargetScrubber.new(
    tags: DEFAULTS[:tags],
    attributes: DEFAULTS[:attributes]
  )

  Loofah.scrub_fragment(html, link_scrubber).to_s
end