Class: SyntaxTree::XML::Document
- Defined in:
- lib/syntax_tree/xml/nodes.rb
Overview
The Document node is the top of the syntax tree. It contains an optional prolog, an optional doctype declaration, any number of optional miscellenous elements like comments, whitespace, or processing instructions, and a root element.
Instance Attribute Summary collapse
-
#doctype ⇒ Object
readonly
Returns the value of attribute doctype.
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#miscs ⇒ Object
readonly
Returns the value of attribute miscs.
-
#prolog ⇒ Object
readonly
Returns the value of attribute prolog.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(prolog:, miscs:, doctype:, element:, location:) ⇒ Document
constructor
A new instance of Document.
Methods inherited from Node
Constructor Details
#initialize(prolog:, miscs:, doctype:, element:, location:) ⇒ Document
Returns a new instance of Document.
84 85 86 87 88 89 90 |
# File 'lib/syntax_tree/xml/nodes.rb', line 84 def initialize(prolog:, miscs:, doctype:, element:, location:) @prolog = prolog @miscs = miscs @doctype = doctype @element = element @location = location end |
Instance Attribute Details
#doctype ⇒ Object (readonly)
Returns the value of attribute doctype.
82 83 84 |
# File 'lib/syntax_tree/xml/nodes.rb', line 82 def doctype @doctype end |
#element ⇒ Object (readonly)
Returns the value of attribute element.
82 83 84 |
# File 'lib/syntax_tree/xml/nodes.rb', line 82 def element @element end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
82 83 84 |
# File 'lib/syntax_tree/xml/nodes.rb', line 82 def location @location end |
#miscs ⇒ Object (readonly)
Returns the value of attribute miscs.
82 83 84 |
# File 'lib/syntax_tree/xml/nodes.rb', line 82 def miscs @miscs end |
#prolog ⇒ Object (readonly)
Returns the value of attribute prolog.
82 83 84 |
# File 'lib/syntax_tree/xml/nodes.rb', line 82 def prolog @prolog end |
Instance Method Details
#accept(visitor) ⇒ Object
92 93 94 |
# File 'lib/syntax_tree/xml/nodes.rb', line 92 def accept(visitor) visitor.visit_document(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
96 97 98 |
# File 'lib/syntax_tree/xml/nodes.rb', line 96 def child_nodes [prolog, *miscs, doctype, element].compact end |
#deconstruct_keys(keys) ⇒ Object
102 103 104 105 106 107 108 109 110 |
# File 'lib/syntax_tree/xml/nodes.rb', line 102 def deconstruct_keys(keys) { prolog: prolog, miscs: miscs, doctype: doctype, element: element, location: location } end |