Class: Code::Node::Ternary
- Inherits:
-
Code::Node
- Object
- Code::Node
- Code::Node::Ternary
- Defined in:
- lib/code/node/ternary.rb
Instance Method Summary collapse
- #evaluate(**args) ⇒ Object
-
#initialize(ternary) ⇒ Ternary
constructor
A new instance of Ternary.
Constructor Details
#initialize(ternary) ⇒ Ternary
Returns a new instance of Ternary.
4 5 6 7 8 9 10 11 |
# File 'lib/code/node/ternary.rb', line 4 def initialize(ternary) @left = ::Code::Node::Statement.new(ternary.fetch(:left)) @middle = ::Code::Node::Statement.new(ternary.fetch(:middle)) if ternary.key?(:right) @right = ::Code::Node::Statement.new(ternary.fetch(:right)) end end |