Class: Riml::TernaryOperatorNode

Inherits:
OperatorNode show all
Defined in:
lib/riml/nodes.rb

Overview

operator = :ternary operands = [condition, if_expr, else_expr]

Constant Summary

Constants included from Visitable

Visitable::EMPTY_CHILDREN

Instance Attribute Summary

Attributes inherited from OperatorNode

#operands, #operator

Attributes included from Visitable

#compiled_output, #force_newline, #parent_node, #parser_info, #scope

Instance Method Summary collapse

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

#conditionObject



476
# File 'lib/riml/nodes.rb', line 476

def condition() operands[0] end

#else_exprObject



480
# File 'lib/riml/nodes.rb', line 480

def else_expr() operands[2] end

#if_exprObject



478
# File 'lib/riml/nodes.rb', line 478

def if_expr() operands[1] end