Class: YARP::ClassVariableWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ClassVariableWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents writing to a class variable.
@@foo = 1
^^^^^^^^^
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
attr_reader name: Symbol.
-
#name_loc ⇒ Object
readonly
attr_reader name_loc: Location.
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location?.
-
#value ⇒ Object
readonly
attr_reader value: Node?.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#copy(**params) ⇒ Object
def copy: (**params) -> ClassVariableWriteNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name, name_loc, value, operator_loc, location) ⇒ ClassVariableWriteNode
constructor
def initialize: (name: Symbol, name_loc: Location, value: Node?, operator_loc: Location?, location: Location) -> void.
-
#operator ⇒ Object
def operator: () -> String?.
Constructor Details
#initialize(name, name_loc, value, operator_loc, location) ⇒ ClassVariableWriteNode
def initialize: (name: Symbol, name_loc: Location, value: Node?, operator_loc: Location?, location: Location) -> void
1690 1691 1692 1693 1694 1695 1696 |
# File 'lib/yarp/node.rb', line 1690 def initialize(name, name_loc, value, operator_loc, location) @name = name @name_loc = name_loc @value = value @operator_loc = operator_loc @location = location end |
Instance Attribute Details
#name ⇒ Object (readonly)
attr_reader name: Symbol
1678 1679 1680 |
# File 'lib/yarp/node.rb', line 1678 def name @name end |
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location
1681 1682 1683 |
# File 'lib/yarp/node.rb', line 1681 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location?
1687 1688 1689 |
# File 'lib/yarp/node.rb', line 1687 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node?
1684 1685 1686 |
# File 'lib/yarp/node.rb', line 1684 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
1699 1700 1701 |
# File 'lib/yarp/node.rb', line 1699 def accept(visitor) visitor.visit_class_variable_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
1704 1705 1706 |
# File 'lib/yarp/node.rb', line 1704 def child_nodes [value] end |
#copy(**params) ⇒ Object
def copy: (**params) -> ClassVariableWriteNode
1709 1710 1711 1712 1713 1714 1715 1716 1717 |
# File 'lib/yarp/node.rb', line 1709 def copy(**params) ClassVariableWriteNode.new( params.fetch(:name) { name }, params.fetch(:name_loc) { name_loc }, params.fetch(:value) { value }, params.fetch(:operator_loc) { operator_loc }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
1723 1724 1725 |
# File 'lib/yarp/node.rb', line 1723 def deconstruct_keys(keys) { name: name, name_loc: name_loc, value: value, operator_loc: operator_loc, location: location } end |
#operator ⇒ Object
def operator: () -> String?
1728 1729 1730 |
# File 'lib/yarp/node.rb', line 1728 def operator operator_loc&.slice end |