Class: SiteDiff::Sanitizer::DomTransform::UnwrapRoot
- Inherits:
-
SiteDiff::Sanitizer::DomTransform
- Object
- SiteDiff::Sanitizer::DomTransform
- SiteDiff::Sanitizer::DomTransform::UnwrapRoot
- Defined in:
- lib/sitediff/sanitize/dom_transform.rb
Overview
Unwrap the root element.
Constant Summary
Constants inherited from SiteDiff::Sanitizer::DomTransform
Instance Method Summary collapse
-
#apply(node) ⇒ Object
Applies the transformation to a DOM node.
Methods inherited from SiteDiff::Sanitizer::DomTransform
create, #initialize, register, #targets, #to_array
Constructor Details
This class inherits a constructor from SiteDiff::Sanitizer::DomTransform
Instance Method Details
#apply(node) ⇒ Object
Applies the transformation to a DOM node.
122 123 124 125 126 |
# File 'lib/sitediff/sanitize/dom_transform.rb', line 122 def apply(node) (node.children.size == 1) || raise(InvalidSanitization, 'Multiple root elements in unwrap_root') node.children = node.children[0].children end |