Class: SyntaxTree::XML::Element::ClosingTag

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/xml/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

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

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

Returns a new instance of ClosingTag.



259
260
261
262
263
264
# File 'lib/syntax_tree/xml/nodes.rb', line 259

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

Instance Attribute Details

#closingObject (readonly)

Returns the value of attribute closing.



257
258
259
# File 'lib/syntax_tree/xml/nodes.rb', line 257

def closing
  @closing
end

#locationObject (readonly)

Returns the value of attribute location.



257
258
259
# File 'lib/syntax_tree/xml/nodes.rb', line 257

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



257
258
259
# File 'lib/syntax_tree/xml/nodes.rb', line 257

def name
  @name
end

#openingObject (readonly)

Returns the value of attribute opening.



257
258
259
# File 'lib/syntax_tree/xml/nodes.rb', line 257

def opening
  @opening
end

Instance Method Details

#accept(visitor) ⇒ Object



266
267
268
# File 'lib/syntax_tree/xml/nodes.rb', line 266

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

#child_nodesObject Also known as: deconstruct



270
271
272
# File 'lib/syntax_tree/xml/nodes.rb', line 270

def child_nodes
  [opening, name, closing]
end

#deconstruct_keys(keys) ⇒ Object



276
277
278
# File 'lib/syntax_tree/xml/nodes.rb', line 276

def deconstruct_keys(keys)
  { opening: opening, name: name, closing: closing, location: location }
end