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.
211 212 213 |
# File 'lib/rails/html/scrubbers.rb', line 211 def initialize @direction = :bottom_up end |
Instance Method Details
#scrub(node) ⇒ Object
215 216 217 218 219 220 221 222 |
# File 'lib/rails/html/scrubbers.rb', line 215 def scrub(node) if node.text? CONTINUE else node.before node.children node.remove end end |