Class: Commonmeta::WhitelistScrubber

Inherits:
Loofah::Scrubber
  • Object
show all
Defined in:
lib/commonmeta/whitelist_scrubber.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ WhitelistScrubber

Returns a new instance of WhitelistScrubber.



7
8
9
10
11
# File 'lib/commonmeta/whitelist_scrubber.rb', line 7

def initialize(options = {})
  @direction = :bottom_up
  @tags = options[:tags]
  @attributes = options[:attributes]
end

Instance Method Details

#scrub(node) ⇒ Object



13
14
15
16
17
18
# File 'lib/commonmeta/whitelist_scrubber.rb', line 13

def scrub(node)
  scrub_node_attributes(node) and return CONTINUE if node_allowed?(node)

  node.before node.children
  node.remove
end