Class: SyntaxTree::Backtick
Overview
Backtick represents the use of the ‘ operator. It’s usually found being used for an XStringLiteral, but could also be found as the name of a method being defined.
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#value ⇒ Object
readonly
- String
-
the backtick in the string.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(_keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(value:, location:, comments: []) ⇒ Backtick
constructor
A new instance of Backtick.
Methods inherited from Node
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:, comments: []) ⇒ Backtick
1406 1407 1408 1409 1410 |
# File 'lib/syntax_tree/node.rb', line 1406 def initialize(value:, location:, comments: []) @value = value @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
1404 1405 1406 |
# File 'lib/syntax_tree/node.rb', line 1404 def comments @comments end |
#value ⇒ Object (readonly)
- String
-
the backtick in the string
1401 1402 1403 |
# File 'lib/syntax_tree/node.rb', line 1401 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
1412 1413 1414 |
# File 'lib/syntax_tree/node.rb', line 1412 def accept(visitor) visitor.visit_backtick(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
1416 1417 1418 |
# File 'lib/syntax_tree/node.rb', line 1416 def child_nodes [] end |
#deconstruct_keys(_keys) ⇒ Object
1422 1423 1424 |
# File 'lib/syntax_tree/node.rb', line 1422 def deconstruct_keys(_keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
1426 1427 1428 |
# File 'lib/syntax_tree/node.rb', line 1426 def format(q) q.text(value) end |