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.
702 703 704 705 706 707 |
# File 'lib/syntax_tree/erb/nodes.rb', line 702 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.
700 701 702 |
# File 'lib/syntax_tree/erb/nodes.rb', line 700 def closing @closing end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
700 701 702 |
# File 'lib/syntax_tree/erb/nodes.rb', line 700 def name @name end |
#opening ⇒ Object (readonly)
Returns the value of attribute opening.
700 701 702 |
# File 'lib/syntax_tree/erb/nodes.rb', line 700 def opening @opening end |
Instance Method Details
#accept(visitor) ⇒ Object
709 710 711 |
# File 'lib/syntax_tree/erb/nodes.rb', line 709 def accept(visitor) visitor.visit_doctype(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
713 714 715 |
# File 'lib/syntax_tree/erb/nodes.rb', line 713 def child_nodes [opening, name, closing].compact end |
#deconstruct_keys(keys) ⇒ Object
719 720 721 |
# File 'lib/syntax_tree/erb/nodes.rb', line 719 def deconstruct_keys(keys) super.merge(opening: opening, name: name, closing: closing) end |