class RuboCop::AST::RescueNode

available to all ‘rescue` nodes within RuboCop.
plain node when the builder constructs the AST, making its methods
A node extension for `rescue` nodes. This will be used in place of a

def body

Returns:
  • (Node, nil) - The body of the rescue node.
def body
  node_parts[0]
end

def branches

Returns:
  • (Array) - an array of the bodies of the rescue branches
def branches
  bodies = resbody_branches.map(&:body)
  bodies.push(else_branch) if else?
  bodies
end

def else?

Returns:
  • (Boolean) - whether the exception handling statement has an `else` branch
def else?
  loc.else
end

def else_branch

Returns:
  • (nil) - if the exception handling statement does not have an else branch.
  • (Node) - the else branch node of the exception handling statement
def else_branch
  node_parts[-1]
end

def resbody_branches

Returns:
  • (Array) - an array of `resbody` nodes
def resbody_branches
  node_parts[1...-1]
end