Class: Chelsy::Operator::Conditional
- Defined in:
- lib/chelsy/ast.rb
Overview
Ternary conditional
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
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(condition, then_expr, else_expr, **rest) ⇒ Conditional
constructor
A new instance of Conditional.
Methods inherited from Base
Constructor Details
#initialize(condition, then_expr, else_expr, **rest) ⇒ Conditional
Returns a new instance of Conditional.
579 580 581 582 583 584 585 |
# File 'lib/chelsy/ast.rb', line 579 def initialize(condition, then_expr, else_expr, **rest) @condition = Syntax::Expr.ensure(condition) @then = Syntax::Expr.ensure(then_expr) @else = Syntax::Expr.ensure(else_expr) super **rest end |
Instance Attribute Details
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
575 576 577 |
# File 'lib/chelsy/ast.rb', line 575 def condition @condition end |
#else ⇒ Object (readonly)
Returns the value of attribute else.
575 576 577 |
# File 'lib/chelsy/ast.rb', line 575 def else @else end |
#then ⇒ Object (readonly)
Returns the value of attribute then.
575 576 577 |
# File 'lib/chelsy/ast.rb', line 575 def then @then end |
Class Method Details
.operator ⇒ Object
577 |
# File 'lib/chelsy/ast.rb', line 577 def self.operator; :"?:" end |