Class: Html::TargetScrubber

Inherits:
PermitScrubber show all
Defined in:
lib/html/sanitizer/scrubbers.rb

Overview

Html::TargetScrubber

Where Html::PermitScrubber picks out tags and attributes to permit in sanitization, Html::TargetScrubber targets them for removal.

tags= If set, elements included will be stripped.

attributes= If set, attributes included will be removed.

Instance Attribute Summary

Attributes inherited from PermitScrubber

#attributes, #tags

Instance Method Summary collapse

Methods inherited from PermitScrubber

#initialize, #scrub

Constructor Details

This class inherits a constructor from Html::PermitScrubber

Instance Method Details

#allowed_node?(node) ⇒ Boolean

Returns:

  • (Boolean)


138
139
140
# File 'lib/html/sanitizer/scrubbers.rb', line 138

def allowed_node?(node)
  !@tags.include?(node.name)
end

#scrub_attribute?(name) ⇒ Boolean

Returns:

  • (Boolean)


142
143
144
# File 'lib/html/sanitizer/scrubbers.rb', line 142

def scrub_attribute?(name)
  @attributes.include?(name)
end