Class: Riml::TernaryOperatorNode
- Inherits:
-
OperatorNode
- Object
- Struct
- OperatorNode
- Riml::TernaryOperatorNode
- Defined in:
- lib/riml/nodes.rb
Overview
operator = :ternary operands = [condition, if_expr, else_expr]
Constant Summary
Constants included from Visitable
Instance Attribute Summary
Attributes inherited from OperatorNode
Attributes included from Visitable
#compiled_output, #force_newline, #parent_node, #parser_info, #scope
Instance Method Summary collapse
- #condition ⇒ Object
- #else_expr ⇒ Object
- #if_expr ⇒ Object
-
#initialize(operands, operator = :ternary) ⇒ TernaryOperatorNode
constructor
A new instance of TernaryOperatorNode.
Methods inherited from OperatorNode
#children, #force_newline_if_child_call_node?
Methods included from Visitable
#accept, #children, #force_newline_if_child_call_node?, #location_info
Methods included from Walkable
#child_after, #child_previous_to, #each, #index_by_children, #index_by_member, #insert_after, #insert_before, #next, #previous, #remove, #replace_with
Constructor Details
#initialize(operands, operator = :ternary) ⇒ TernaryOperatorNode
Returns a new instance of TernaryOperatorNode.
472 473 474 |
# File 'lib/riml/nodes.rb', line 472 def initialize(operands, operator=:ternary) super(operator, operands) end |
Instance Method Details
#condition ⇒ Object
476 |
# File 'lib/riml/nodes.rb', line 476 def condition() operands[0] end |
#else_expr ⇒ Object
480 |
# File 'lib/riml/nodes.rb', line 480 def else_expr() operands[2] end |
#if_expr ⇒ Object
478 |
# File 'lib/riml/nodes.rb', line 478 def if_expr() operands[1] end |