Represents a begin statement.

begin
  foo
end
^^^^^
Attributes
Read

Represents the statements within the begin block.

begin x end
      ^

Represents the rescue clause within the begin block.

begin x; rescue y; end
         ^^^^^^^^

Represents the else clause within the begin block.

begin x; rescue y; else z; end
                   ^^^^^^

Represents the ensure clause within the begin block.

begin x; ensure y; end
         ^^^^^^^^
Class Methods

Initialize a new BeginNode 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 begin_keyword: () -> String?

Represents the location of the ‘begin` keyword.

begin x end
^^^^^

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

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

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?begin_keyword_loc: Location?, ?statements: StatementsNode?, ?rescue_clause: RescueNode?, ?else_clause: ElseNode?, ?ensure_clause: EnsureNode?, ?end_keyword_loc: Location?) -> BeginNode

An alias for child_nodes

def end_keyword: () -> String?

Represents the location of the ‘end` keyword.

begin x end
        ^^^

def inspect -> String

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

Save the end_keyword_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`.