Class: YARP::EmbeddedVariableNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::EmbeddedVariableNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents an interpolated variable.
"foo #@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].
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#copy(**params) ⇒ Object
def copy: (**params) -> EmbeddedVariableNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(operator_loc, variable, location) ⇒ EmbeddedVariableNode
constructor
def initialize: (operator_loc: Location, variable: Node, location: Location) -> void.
- #inspect(inspector = NodeInspector.new) ⇒ Object
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(operator_loc, variable, location) ⇒ EmbeddedVariableNode
def initialize: (operator_loc: Location, variable: Node, location: Location) -> void
3816 3817 3818 3819 3820 |
# File 'lib/yarp/node.rb', line 3816 def initialize(operator_loc, variable, location) @operator_loc = operator_loc @variable = variable @location = location end |
Instance Attribute Details
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
3810 3811 3812 |
# File 'lib/yarp/node.rb', line 3810 def operator_loc @operator_loc end |
#variable ⇒ Object (readonly)
attr_reader variable: Node
3813 3814 3815 |
# File 'lib/yarp/node.rb', line 3813 def variable @variable end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
3823 3824 3825 |
# File 'lib/yarp/node.rb', line 3823 def accept(visitor) visitor.(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
3828 3829 3830 |
# File 'lib/yarp/node.rb', line 3828 def child_nodes [variable] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
3833 3834 3835 |
# File 'lib/yarp/node.rb', line 3833 def comment_targets [operator_loc, variable] end |
#copy(**params) ⇒ Object
def copy: (**params) -> EmbeddedVariableNode
3838 3839 3840 3841 3842 3843 3844 |
# File 'lib/yarp/node.rb', line 3838 def copy(**params) EmbeddedVariableNode.new( params.fetch(:operator_loc) { operator_loc }, params.fetch(:variable) { variable }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
3850 3851 3852 |
# File 'lib/yarp/node.rb', line 3850 def deconstruct_keys(keys) { operator_loc: operator_loc, variable: variable, location: location } end |
#inspect(inspector = NodeInspector.new) ⇒ Object
3859 3860 3861 3862 3863 3864 3865 |
# File 'lib/yarp/node.rb', line 3859 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n" inspector << "└── variable:\n" inspector << inspector.child_node(variable, " ") inspector.to_str end |
#operator ⇒ Object
def operator: () -> String
3855 3856 3857 |
# File 'lib/yarp/node.rb', line 3855 def operator operator_loc.slice end |