Class: Riml::TernaryOperatorNode

Inherits:
OperatorNode show all
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

#operands, #operator

Attributes included from Visitable

#compiled_output, #force_newline, #parent_node, #scope

Instance Method Summary collapse

Methods inherited from OperatorNode

#children

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

#conditionObject



473
# File 'lib/nodes.rb', line 473

def condition() operands[0] end

#else_exprObject



477
# File 'lib/nodes.rb', line 477

def else_expr() operands[2] end

#if_exprObject



475
# File 'lib/nodes.rb', line 475

def if_expr() operands[1] end