Class: Loofah::Scrubbers::NewlineBlockElements
- Inherits:
-
Loofah::Scrubber
- Object
- Loofah::Scrubber
- Loofah::Scrubbers::NewlineBlockElements
- Defined in:
- lib/loofah/scrubbers.rb
Overview
This class probably isn’t useful publicly, but is used for #to_text’s current implemention
Constant Summary
Constants inherited from Loofah::Scrubber
Loofah::Scrubber::CONTINUE, Loofah::Scrubber::STOP
Instance Attribute Summary
Attributes inherited from Loofah::Scrubber
Instance Method Summary collapse
-
#initialize ⇒ NewlineBlockElements
constructor
:nodoc:.
- #scrub(node) ⇒ Object
Methods inherited from Loofah::Scrubber
Constructor Details
#initialize ⇒ NewlineBlockElements
:nodoc:
238 239 240 |
# File 'lib/loofah/scrubbers.rb', line 238 def initialize @direction = :bottom_up end |
Instance Method Details
#scrub(node) ⇒ Object
242 243 244 245 246 |
# File 'lib/loofah/scrubbers.rb', line 242 def scrub(node) return CONTINUE unless Loofah::Elements::BLOCK_LEVEL.include?(node.name) node.add_next_sibling Nokogiri::XML::Text.new("\n#{node.content}\n", node.document) node.remove end |