Class: YARP::BlockParameterNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::BlockParameterNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents a block parameter to a method, block, or lambda definition.
def a(&b)
^^
end
Instance Attribute Summary collapse
-
#name_loc ⇒ Object
readonly
attr_reader name_loc: Location?.
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location.
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(name_loc, operator_loc, location) ⇒ BlockParameterNode
constructor
def initialize: (name_loc: Location?, operator_loc: Location, location: Location) -> void.
-
#name ⇒ Object
def name: () -> String?.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(name_loc, operator_loc, location) ⇒ BlockParameterNode
def initialize: (name_loc: Location?, operator_loc: Location, location: Location) -> void
618 619 620 621 622 |
# File 'lib/yarp/node.rb', line 618 def initialize(name_loc, operator_loc, location) @name_loc = name_loc @operator_loc = operator_loc @location = location end |
Instance Attribute Details
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location?
612 613 614 |
# File 'lib/yarp/node.rb', line 612 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
615 616 617 |
# File 'lib/yarp/node.rb', line 615 def operator_loc @operator_loc end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
625 626 627 |
# File 'lib/yarp/node.rb', line 625 def accept(visitor) visitor.visit_block_parameter_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
631 632 633 |
# File 'lib/yarp/node.rb', line 631 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
639 640 641 |
# File 'lib/yarp/node.rb', line 639 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, location: location } end |
#name ⇒ Object
def name: () -> String?
644 645 646 |
# File 'lib/yarp/node.rb', line 644 def name name_loc&.slice end |
#operator ⇒ Object
def operator: () -> String
649 650 651 |
# File 'lib/yarp/node.rb', line 649 def operator operator_loc.slice end |