Class: Melbourne::AST::If
- Defined in:
- lib/melbourne/ast/control_flow.rb
Overview
An if statement as in:
a if true
Instance Attribute Summary collapse
-
#body ⇒ Object
The body of the
ifstatement (the code that is executed if theconditionevaluates to true). -
#condition ⇒ Object
The condition of the
ifstatement. -
#else ⇒ Object
The
elseblock of theifstatement (if there is one).
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(line, condition, body, else_body) ⇒ If
constructor
A new instance of If.
Methods inherited from Node
Constructor Details
#initialize(line, condition, body, else_body) ⇒ If
Returns a new instance of If.
179 180 181 182 183 184 |
# File 'lib/melbourne/ast/control_flow.rb', line 179 def initialize(line, condition, body, else_body) @line = line @condition = condition @body = body || Nil.new(line) @else = else_body || Nil.new(line) end |
Instance Attribute Details
#body ⇒ Object
The body of the if statement (the code that is executed if the condition evaluates to true)
173 174 175 |
# File 'lib/melbourne/ast/control_flow.rb', line 173 def body @body end |
#condition ⇒ Object
The condition of the if statement
169 170 171 |
# File 'lib/melbourne/ast/control_flow.rb', line 169 def condition @condition end |
#else ⇒ Object
The else block of the if statement (if there is one)
177 178 179 |
# File 'lib/melbourne/ast/control_flow.rb', line 177 def else @else end |