Class: YARP::PinnedVariableNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::PinnedVariableNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘^` operator for pinning a variable in a pattern matching expression.
foo in ^bar
^^^^
Instance Attribute Summary collapse
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location.
-
#variable ⇒ Object
readonly
attr_reader variable: Node.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(variable, operator_loc, location) ⇒ PinnedVariableNode
constructor
def initialize: (variable: Node, operator_loc: Location, location: Location) -> void.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(variable, operator_loc, location) ⇒ PinnedVariableNode
def initialize: (variable: Node, operator_loc: Location, location: Location) -> void
4727 4728 4729 4730 4731 |
# File 'lib/yarp/node.rb', line 4727 def initialize(variable, operator_loc, location) @variable = variable @operator_loc = operator_loc @location = location end |
Instance Attribute Details
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
4724 4725 4726 |
# File 'lib/yarp/node.rb', line 4724 def operator_loc @operator_loc end |
#variable ⇒ Object (readonly)
attr_reader variable: Node
4721 4722 4723 |
# File 'lib/yarp/node.rb', line 4721 def variable @variable end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4734 4735 4736 |
# File 'lib/yarp/node.rb', line 4734 def accept(visitor) visitor.visit_pinned_variable_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4740 4741 4742 |
# File 'lib/yarp/node.rb', line 4740 def child_nodes [variable] end |
#deconstruct_keys(keys) ⇒ Object
4748 4749 4750 |
# File 'lib/yarp/node.rb', line 4748 def deconstruct_keys(keys) { variable: variable, operator_loc: operator_loc, location: location } end |
#operator ⇒ Object
def operator: () -> String
4753 4754 4755 |
# File 'lib/yarp/node.rb', line 4753 def operator operator_loc.slice end |