Class: LibRubyParser::Nodes::If
- Inherits:
-
LibRubyParser::Node
- Object
- LibRubyParser::Node
- LibRubyParser::Nodes::If
- 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
-
#begin_l ⇒ Loc
readonly
Location of the
then
keyword. -
#cond ⇒ Node
readonly
Condition given to the
if
statement,Lvar("a")
forif a; b; else; c; end
. -
#else_l ⇒ Loc?
readonly
Location of the
else
keyword. -
#end_l ⇒ Loc?
readonly
Location of the
end
keyword. -
#expression_l ⇒ Loc
readonly
Location of the full expression.
-
#if_false ⇒ Node?
readonly
False-branch of the
if
statement,Lvar("c")
forif a; b; else; c; end
. -
#if_true ⇒ Node?
readonly
True-branch of the
if
statement,Lvar("b")
forif a; b; else; c; end
. -
#keyword_l ⇒ Loc
readonly
Location of the
if
keyword.
Instance Attribute Details
#begin_l ⇒ Loc (readonly)
Location of the then
keyword
if foo then; end
~~~~
None
if then
keyword is omitted
1815 1816 1817 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1815 def begin_l @begin_l end |
#cond ⇒ Node (readonly)
Condition given to the if
statement, Lvar("a")
for if a; b; else; c; end
1787 1788 1789 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1787 def cond @cond end |
#else_l ⇒ Loc? (readonly)
Location of the else
keyword
if foo; else; end
~~~~
None
if there's no else
branch
1826 1827 1828 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1826 def else_l @else_l end |
#end_l ⇒ Loc? (readonly)
Location of the end
keyword
if foo; end
~~~
1835 1836 1837 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1835 def end_l @end_l end |
#expression_l ⇒ Loc (readonly)
Location of the full expression
if a then; b; else; c end
~~~~~~~~~~~~~~~~~~~~~~~~~
1844 1845 1846 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1844 def expression_l @expression_l end |
#if_false ⇒ Node? (readonly)
False-branch of the if
statement, Lvar("c")
for if a; b; else; c; end
1795 1796 1797 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1795 def if_false @if_false end |
#if_true ⇒ Node? (readonly)
True-branch of the if
statement, Lvar("b")
for if a; b; else; c; end
1791 1792 1793 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1791 def if_true @if_true end |
#keyword_l ⇒ Loc (readonly)
Location of the if
keyword
if foo; end
~~
1804 1805 1806 |
# File 'lib/lib-ruby-parser/nodes.rb', line 1804 def keyword_l @keyword_l end |