Class: SyntaxTree::XML::Element::OpeningTag
- Defined in:
- lib/syntax_tree/xml/nodes.rb
Overview
The opening tag of an element. It contains the opening character (<), the name of the element, any optional attributes, and the closing token (either > or />).
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#closing ⇒ Object
readonly
Returns the value of attribute closing.
-
#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:, attributes:, closing:, location:) ⇒ OpeningTag
constructor
A new instance of OpeningTag.
Methods inherited from Node
Constructor Details
#initialize(opening:, name:, attributes:, closing:, location:) ⇒ OpeningTag
225 226 227 228 229 230 231 |
# File 'lib/syntax_tree/xml/nodes.rb', line 225 def initialize(opening:, name:, attributes:, closing:, location:) @opening = opening @name = name @attributes = attributes @closing = closing @location = location end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
223 224 225 |
# File 'lib/syntax_tree/xml/nodes.rb', line 223 def attributes @attributes end |
#closing ⇒ Object (readonly)
Returns the value of attribute closing.
223 224 225 |
# File 'lib/syntax_tree/xml/nodes.rb', line 223 def closing @closing end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
223 224 225 |
# File 'lib/syntax_tree/xml/nodes.rb', line 223 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
223 224 225 |
# File 'lib/syntax_tree/xml/nodes.rb', line 223 def name @name end |
#opening ⇒ Object (readonly)
Returns the value of attribute opening.
223 224 225 |
# File 'lib/syntax_tree/xml/nodes.rb', line 223 def opening @opening end |
Instance Method Details
#accept(visitor) ⇒ Object
233 234 235 |
# File 'lib/syntax_tree/xml/nodes.rb', line 233 def accept(visitor) visitor.visit_opening_tag(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
237 238 239 |
# File 'lib/syntax_tree/xml/nodes.rb', line 237 def child_nodes [opening, name, *attributes, closing] end |
#deconstruct_keys(keys) ⇒ Object
243 244 245 246 247 248 249 250 251 |
# File 'lib/syntax_tree/xml/nodes.rb', line 243 def deconstruct_keys(keys) { opening: opening, name: name, attributes: attributes, closing: closing, location: location } end |