Class: SyntaxTree::ERB::Doctype
- Defined in:
- lib/syntax_tree/erb/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.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#opening ⇒ Object
readonly
Returns the value of attribute opening.
Attributes inherited from Element
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(opening:, name:, closing:, new_line:, location:) ⇒ Doctype
constructor
A new instance of Doctype.
Methods inherited from Element
Methods inherited from Node
#format, #pretty_print, #skip?, #without_new_line
Constructor Details
#initialize(opening:, name:, closing:, new_line:, location:) ⇒ Doctype
Returns a new instance of Doctype.
672 673 674 675 676 677 |
# File 'lib/syntax_tree/erb/nodes.rb', line 672 def initialize(opening:, name:, closing:, new_line:, location:) super(new_line: new_line, location: location) @opening = opening @name = name @closing = closing end |
Instance Attribute Details
#closing ⇒ Object (readonly)
Returns the value of attribute closing.
670 671 672 |
# File 'lib/syntax_tree/erb/nodes.rb', line 670 def closing @closing end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
670 671 672 |
# File 'lib/syntax_tree/erb/nodes.rb', line 670 def name @name end |
#opening ⇒ Object (readonly)
Returns the value of attribute opening.
670 671 672 |
# File 'lib/syntax_tree/erb/nodes.rb', line 670 def opening @opening end |
Instance Method Details
#accept(visitor) ⇒ Object
679 680 681 |
# File 'lib/syntax_tree/erb/nodes.rb', line 679 def accept(visitor) visitor.visit_doctype(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
683 684 685 |
# File 'lib/syntax_tree/erb/nodes.rb', line 683 def child_nodes [opening, name, closing].compact end |
#deconstruct_keys(keys) ⇒ Object
689 690 691 |
# File 'lib/syntax_tree/erb/nodes.rb', line 689 def deconstruct_keys(keys) super.merge(opening: opening, name: name, closing: closing) end |