Class: SyntaxTree::XML::DocType
- Defined in:
- lib/syntax_tree/xml/nodes.rb
Overview
A document type declaration is a special kind of tag that specifies the type of the document. It contains an opening declaration, the name of the document type, an optional external identifier, and a closing of the tag.
Instance Attribute Summary collapse
-
#closing ⇒ Object
readonly
Returns the value of attribute closing.
-
#external_id ⇒ Object
readonly
Returns the value of attribute external_id.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#opening ⇒ Object
readonly
Returns the value of attribute opening.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(opening:, name:, external_id:, closing:, location:) ⇒ DocType
constructor
A new instance of DocType.
Methods inherited from Node
Constructor Details
#initialize(opening:, name:, external_id:, closing:, location:) ⇒ DocType
152 153 154 155 156 157 158 |
# File 'lib/syntax_tree/xml/nodes.rb', line 152 def initialize(opening:, name:, external_id:, closing:, location:) @opening = opening @name = name @external_id = external_id @closing = closing @location = location end |
Instance Attribute Details
#closing ⇒ Object (readonly)
Returns the value of attribute closing.
150 151 152 |
# File 'lib/syntax_tree/xml/nodes.rb', line 150 def closing @closing end |
#external_id ⇒ Object (readonly)
Returns the value of attribute external_id.
150 151 152 |
# File 'lib/syntax_tree/xml/nodes.rb', line 150 def external_id @external_id end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
150 151 152 |
# File 'lib/syntax_tree/xml/nodes.rb', line 150 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
150 151 152 |
# File 'lib/syntax_tree/xml/nodes.rb', line 150 def name @name end |
#opening ⇒ Object (readonly)
Returns the value of attribute opening.
150 151 152 |
# File 'lib/syntax_tree/xml/nodes.rb', line 150 def opening @opening end |
Instance Method Details
#accept(visitor) ⇒ Object
160 161 162 |
# File 'lib/syntax_tree/xml/nodes.rb', line 160 def accept(visitor) visitor.visit_doctype(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
164 165 166 |
# File 'lib/syntax_tree/xml/nodes.rb', line 164 def child_nodes [opening, name, external_id, closing].compact end |
#deconstruct_keys(keys) ⇒ Object
170 171 172 173 174 175 176 177 178 |
# File 'lib/syntax_tree/xml/nodes.rb', line 170 def deconstruct_keys(keys) { opening: opening, name: name, external_id: external_id, closing: closing, location: location } end |