Class: LibRubyParser::Nodes::Ensure

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

Overview

Represents a block of code with ensure (i.e. begin; ensure; end)

Instance Attribute Summary collapse

Instance Attribute Details

#bodyNode? (readonly)

Block of code that is wrapped into ensure Note: that's the body of the ensure block

Int("1") for begin; 1; ensure; 2; end

Returns:



1355
1356
1357
# File 'lib/lib-ruby-parser/nodes.rb', line 1355

def body
  @body
end

#ensureNode? (readonly)

Body of the ensure block

Int("2") for begin; 1; ensure; 2; end

Returns:



1361
1362
1363
# File 'lib/lib-ruby-parser/nodes.rb', line 1361

def ensure
  @ensure
end

#expression_lLoc (readonly)

Location of the full expression

begin; 1; rescue; 2; else; 3; ensure; 4; end
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note: begin/end belong to KwBegin node.

Returns:



1381
1382
1383
# File 'lib/lib-ruby-parser/nodes.rb', line 1381

def expression_l
  @expression_l
end

#keyword_lLoc (readonly)

Location of the ensure keyword

begin; ensure; end
       ~~~~~~

Returns:



1370
1371
1372
# File 'lib/lib-ruby-parser/nodes.rb', line 1370

def keyword_l
  @keyword_l
end