Class: LibRubyParser::Nodes::If

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

Overview

Represents an if statement (i.e. if foo; bar; else; baz; end)

Instance Attribute Summary collapse

Instance Attribute Details

#begin_lLoc (readonly)

Location of the then keyword

if foo then; end
       ~~~~

None if then keyword is omitted

Returns:



1815
1816
1817
# File 'lib/lib-ruby-parser/nodes.rb', line 1815

def begin_l
  @begin_l
end

#condNode (readonly)

Condition given to the if statement, Lvar("a") for if a; b; else; c; end

Returns:



1787
1788
1789
# File 'lib/lib-ruby-parser/nodes.rb', line 1787

def cond
  @cond
end

#else_lLoc? (readonly)

Location of the else keyword

if foo; else; end
        ~~~~

None if there's no else branch

Returns:



1826
1827
1828
# File 'lib/lib-ruby-parser/nodes.rb', line 1826

def else_l
  @else_l
end

#end_lLoc? (readonly)

Location of the end keyword

if foo; end
        ~~~

Returns:



1835
1836
1837
# File 'lib/lib-ruby-parser/nodes.rb', line 1835

def end_l
  @end_l
end

#expression_lLoc (readonly)

Location of the full expression

if a then; b; else; c end
~~~~~~~~~~~~~~~~~~~~~~~~~

Returns:



1844
1845
1846
# File 'lib/lib-ruby-parser/nodes.rb', line 1844

def expression_l
  @expression_l
end

#if_falseNode? (readonly)

False-branch of the if statement, Lvar("c") for if a; b; else; c; end

Returns:



1795
1796
1797
# File 'lib/lib-ruby-parser/nodes.rb', line 1795

def if_false
  @if_false
end

#if_trueNode? (readonly)

True-branch of the if statement, Lvar("b") for if a; b; else; c; end

Returns:



1791
1792
1793
# File 'lib/lib-ruby-parser/nodes.rb', line 1791

def if_true
  @if_true
end

#keyword_lLoc (readonly)

Location of the if keyword

if foo; end
~~

Returns:



1804
1805
1806
# File 'lib/lib-ruby-parser/nodes.rb', line 1804

def keyword_l
  @keyword_l
end