Represents a block of ruby code.

[1, 2, 3].each { |i| puts x }
               ^^^^^^^^^^^^^^
Attributes
Read

The local variables declared in the block.

[1, 2, 3].each { |i| puts x } # locals: [:i]
                  ^
Read

The parameters of the block.

[1, 2, 3].each { |i| puts x }
                 ^^^
[1, 2, 3].each { puts _1 }
               ^^^^^^^^^^^
[1, 2, 3].each { puts it }
               ^^^^^^^^^^^
Read

The body of the block.

[1, 2, 3].each { |i| puts x }
                     ^^^^^^
Class Methods

Initialize a new BlockNode node.

Return a symbol representation of this node type. See ‘Node::type`.

Instance Methods

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.

def accept: (Visitor visitor) -> void

def child_nodes: () -> Array[nil | Node]

def closing: () -> String

Represents the location of the closing ‘|`.

[1, 2, 3].each { |i| puts x }
                   ^

def comment_targets: () -> Array[Node | Location]

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array, ?parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil, ?body: StatementsNode | BeginNode | nil, ?opening_loc: Location, ?closing_loc: Location) -> BlockNode

An alias for child_nodes

def inspect -> String

def opening: () -> String

Represents the location of the opening ‘|`.

[1, 2, 3].each { |i| puts x }
                 ^

Save the closing_loc location using the given saved source so that it can be retrieved later.

Save the opening_loc location using the given saved source so that it can be retrieved later.

Return a symbol representation of this node type. See ‘Node#type`.