Class: LibRubyParser::Nodes::Rescue

Inherits:
LibRubyParser::Node show all
Defined in:
lib/lib-ruby-parser/nodes.rb

Overview

Represents a rescue block

Instance Attribute Summary collapse

Instance Attribute Details

#bodyNode? (readonly)

Body of the block that is wrapped into rescue (i.e. the part that may throw an error)

Returns:



3495
3496
3497
# File 'lib/lib-ruby-parser/nodes.rb', line 3495

def body
  @body
end

#elseNode? (readonly)

Else branch.

None if there's no else branch

Returns:



3505
3506
3507
# File 'lib/lib-ruby-parser/nodes.rb', line 3505

def else
  @else
end

#else_lLoc? (readonly)

Location of the else keyword

begin; 1; rescue StandardError => e; 2; else; 3; end
                                        ~~~~

None if there's no else branch

Returns:



3516
3517
3518
# File 'lib/lib-ruby-parser/nodes.rb', line 3516

def else_l
  @else_l
end

#expression_lLoc (readonly)

Location of the full expression

begin; 1; rescue StandardError => e; 2; else; 3; end
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note: begin/end keywords belong to KwBegin node

Returns:



3527
3528
3529
# File 'lib/lib-ruby-parser/nodes.rb', line 3527

def expression_l
  @expression_l
end

#rescue_bodies::Array<Node> (readonly)

A list of rescue handlers (see RescueBody node)

Returns:



3499
3500
3501
# File 'lib/lib-ruby-parser/nodes.rb', line 3499

def rescue_bodies
  @rescue_bodies
end