Class: Rails::HTML::TextOnlyScrubber
- Inherits:
-
Loofah::Scrubber
- Object
- Loofah::Scrubber
- Rails::HTML::TextOnlyScrubber
- Defined in:
- lib/rails/html/scrubbers.rb
Overview
Rails::HTML::TextOnlyScrubber
Rails::HTML::TextOnlyScrubber
allows you to permit text nodes.
Unallowed elements will be stripped, i.e. element is removed but its subtree kept.
Instance Method Summary collapse
-
#initialize ⇒ TextOnlyScrubber
constructor
A new instance of TextOnlyScrubber.
- #scrub(node) ⇒ Object
Constructor Details
#initialize ⇒ TextOnlyScrubber
Returns a new instance of TextOnlyScrubber.
187 188 189 |
# File 'lib/rails/html/scrubbers.rb', line 187 def initialize @direction = :bottom_up end |
Instance Method Details
#scrub(node) ⇒ Object
191 192 193 194 195 196 197 198 |
# File 'lib/rails/html/scrubbers.rb', line 191 def scrub(node) if node.text? CONTINUE else node.before node.children node.remove end end |