Class: YARP::BlockArgumentNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::BlockArgumentNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents block method arguments.
bar(&args)
^^^^^^^^^^
Instance Attribute Summary collapse
-
#expression ⇒ Object
readonly
attr_reader expression: Node?.
-
#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].
-
#copy(**params) ⇒ Object
def copy: (**params) -> BlockArgumentNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(expression, operator_loc, location) ⇒ BlockArgumentNode
constructor
def initialize: (expression: Node?, operator_loc: Location, location: Location) -> void.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(expression, operator_loc, location) ⇒ BlockArgumentNode
def initialize: (expression: Node?, operator_loc: Location, location: Location) -> void
605 606 607 608 609 |
# File 'lib/yarp/node.rb', line 605 def initialize(expression, operator_loc, location) @expression = expression @operator_loc = operator_loc @location = location end |
Instance Attribute Details
#expression ⇒ Object (readonly)
attr_reader expression: Node?
599 600 601 |
# File 'lib/yarp/node.rb', line 599 def expression @expression end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
602 603 604 |
# File 'lib/yarp/node.rb', line 602 def operator_loc @operator_loc end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
612 613 614 |
# File 'lib/yarp/node.rb', line 612 def accept(visitor) visitor.visit_block_argument_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
617 618 619 |
# File 'lib/yarp/node.rb', line 617 def child_nodes [expression] end |
#copy(**params) ⇒ Object
def copy: (**params) -> BlockArgumentNode
622 623 624 625 626 627 628 |
# File 'lib/yarp/node.rb', line 622 def copy(**params) BlockArgumentNode.new( params.fetch(:expression) { expression }, params.fetch(:operator_loc) { operator_loc }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
634 635 636 |
# File 'lib/yarp/node.rb', line 634 def deconstruct_keys(keys) { expression: expression, operator_loc: operator_loc, location: location } end |
#operator ⇒ Object
def operator: () -> String
639 640 641 |
# File 'lib/yarp/node.rb', line 639 def operator operator_loc.slice end |