Class: SyntaxTree::ERB::HtmlNode::ClosingTag

Inherits:
Element
  • Object
show all
Defined in:
lib/syntax_tree/erb/nodes.rb

Overview

The closing tag of an element. It contains the opening character (<), the name of the element, and the closing character (>).

Instance Attribute Summary collapse

Attributes inherited from Element

#location, #new_line

Instance Method Summary collapse

Methods inherited from Element

#without_new_line

Methods inherited from Node

#format, #pretty_print, #skip?, #without_new_line

Constructor Details

#initialize(opening:, name:, closing:, location:, new_line:) ⇒ ClosingTag

Returns a new instance of ClosingTag.



215
216
217
218
219
220
# File 'lib/syntax_tree/erb/nodes.rb', line 215

def initialize(opening:, name:, closing:, location:, new_line:)
  super(new_line: new_line, location: location)
  @opening = opening
  @name = name
  @closing = closing
end

Instance Attribute Details

#closingObject (readonly)

Returns the value of attribute closing.



213
214
215
# File 'lib/syntax_tree/erb/nodes.rb', line 213

def closing
  @closing
end

#nameObject (readonly)

Returns the value of attribute name.



213
214
215
# File 'lib/syntax_tree/erb/nodes.rb', line 213

def name
  @name
end

#openingObject (readonly)

Returns the value of attribute opening.



213
214
215
# File 'lib/syntax_tree/erb/nodes.rb', line 213

def opening
  @opening
end

Instance Method Details

#accept(visitor) ⇒ Object



222
223
224
# File 'lib/syntax_tree/erb/nodes.rb', line 222

def accept(visitor)
  visitor.visit_closing_tag(self)
end

#child_nodesObject Also known as: deconstruct



226
227
228
# File 'lib/syntax_tree/erb/nodes.rb', line 226

def child_nodes
  [opening, name, closing]
end

#deconstruct_keys(keys) ⇒ Object



232
233
234
# File 'lib/syntax_tree/erb/nodes.rb', line 232

def deconstruct_keys(keys)
  super.merge(opening: opening, name: name, closing: closing)
end