Class: Nokogiri::XML::Document
- Inherits:
-
Node
- Object
- Node
- Nokogiri::XML::Document
show all
- Defined in:
- lib/nokogiri/xml/document.rb
Constant Summary
Constants inherited
from Node
Node::ATTRIBUTE_DECL, Node::CDATA_SECTION_NODE, 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, #cdata?, #children, #collect_namespaces, #comment?, #content=, #css, #css_path, #decorate!, #has_attribute?, #html?, #next, #remove, #search, #set_attribute, #text, #to_html, #traverse, #xml?, #xpath
Instance Method Details
#decorate(node) ⇒ Object
Apply any decorators to node
14
15
16
17
18
19
|
# File 'lib/nokogiri/xml/document.rb', line 14
def decorate(node)
key = node.class.name.split('::').last.downcase
decorators[key].each do |klass|
node.extend(klass)
end
end
|
#decorators ⇒ Object
4
5
6
|
# File 'lib/nokogiri/xml/document.rb', line 4
def decorators
@decorators ||= Hash.new { |h,k| h[k] = [] }
end
|
#name ⇒ Object
8
9
10
|
# File 'lib/nokogiri/xml/document.rb', line 8
def name
'document'
end
|
#namespaces ⇒ Object
25
26
27
|
# File 'lib/nokogiri/xml/document.rb', line 25
def namespaces
root ? root.collect_namespaces : {}
end
|
#to_xml ⇒ Object
21
22
23
|
# File 'lib/nokogiri/xml/document.rb', line 21
def to_xml
serialize
end
|