Class: Chelsy::If
Overview
=== 6.8.4.1 The if statement
Instance Attribute Summary collapse
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#else ⇒ Object
readonly
Returns the value of attribute else.
-
#then ⇒ Object
readonly
Returns the value of attribute then.
Attributes inherited from Element
Instance Method Summary collapse
-
#initialize(condition_expr, then_stmt, else_stmt = nil, **rest) ⇒ If
constructor
A new instance of If.
Constructor Details
#initialize(condition_expr, then_stmt, else_stmt = nil, **rest) ⇒ If
Returns a new instance of If.
972 973 974 975 976 977 978 |
# File 'lib/chelsy/ast.rb', line 972 def initialize(condition_expr, then_stmt, else_stmt=nil, **rest) @condition = Syntax::Expr.ensure(condition_expr) @then = Syntax::Stmt::ensure(then_stmt) @else = Syntax::Stmt::ensure(else_stmt) if else_stmt super **rest end |
Instance Attribute Details
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
970 971 972 |
# File 'lib/chelsy/ast.rb', line 970 def condition @condition end |
#else ⇒ Object (readonly)
Returns the value of attribute else.
970 971 972 |
# File 'lib/chelsy/ast.rb', line 970 def else @else end |
#then ⇒ Object (readonly)
Returns the value of attribute then.
970 971 972 |
# File 'lib/chelsy/ast.rb', line 970 def then @then end |