Class: Riml::TernaryOperatorNode
- Inherits:
-
OperatorNode
- Object
- Struct
- OperatorNode
- Riml::TernaryOperatorNode
- Defined in:
- lib/nodes.rb
Overview
operator = :ternary operands = [condition, if_expr, else_expr]
Constant Summary
Constants included from Visitable
Visitable::DESCENDANT_OF_REGEX
Instance Attribute Summary
Attributes inherited from OperatorNode
Attributes included from Visitable
#compiled_output, #force_newline, #parent_node, #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
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
Methods included from Visitable
#accept, #method_missing, #respond_to?
Constructor Details
#initialize(operands, operator = :ternary) ⇒ TernaryOperatorNode
Returns a new instance of TernaryOperatorNode.
469 470 471 |
# File 'lib/nodes.rb', line 469 def initialize(operands, operator=:ternary) super(operator, operands) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Riml::Visitable
Instance Method Details
#condition ⇒ Object
473 |
# File 'lib/nodes.rb', line 473 def condition() operands[0] end |
#else_expr ⇒ Object
477 |
# File 'lib/nodes.rb', line 477 def else_expr() operands[2] end |
#if_expr ⇒ Object
475 |
# File 'lib/nodes.rb', line 475 def if_expr() operands[1] end |