Class: Nokogiri::XML::Document

Inherits:
Node
  • Object
show all
Defined in:
lib/nokogiri/xml/document.rb

Direct Known Subclasses

HTML::Document

Constant Summary

Constants inherited from Node

Node::ATTRIBUTE_DECL, Node::COMMENT_NODE, Node::DOCB_DOCUMENT_NODE, Node::DOCUMENT_NODE, Node::DTD_NODE, Node::ELEMENT_DECL, Node::ENTITY_DECL, Node::HTML_DOCUMENT_NODE, Node::NAMESPACE_DECL, Node::XINCLUDE_END, Node::XINCLUDE_START

Instance Method Summary collapse

Methods inherited from Node

#[], #after, #at, #before, #children, #comment?, #content=, #css_path, #decorate!, #find, #find_by_css, #find_by_xpath, #has_attribute?, #html?, #inner_text, #next, #remove_attribute, #set_attribute, #to_html, #xml?, #xpath

Instance Method Details

#decorate(node) ⇒ Object

Apply any decorators to node



10
11
12
13
14
15
# File 'lib/nokogiri/xml/document.rb', line 10

def decorate(node)
  key = node.class.name.split('::').last.downcase
  decorators[key].each do |klass|
    node.extend(klass)
  end
end

#decoratorsObject



4
5
6
# File 'lib/nokogiri/xml/document.rb', line 4

def decorators
  @decorators ||= Hash.new { |h,k| h[k] = [] }
end

#to_xmlObject



17
18
19
# File 'lib/nokogiri/xml/document.rb', line 17

def to_xml
  serialize
end