Sha256: d1b429375762bd34f62cdfda82a60f57e47b4d34bb0bbd1ebc4523bdd418848a
Contents?: true
Size: 586 Bytes
Versions: 21
Compression:
Stored size: 586 Bytes
Contents
class Code class Node class Ternary < Node def initialize(parsed) @left = Node::Statement.new(parsed.delete(:left)) @middle = Node::Statement.new(parsed.delete(:middle)) if parsed.key?(:right) @right = Node::Statement.new(parsed.delete(:right)) end super(parsed) end def evaluate(**args) if @left.evaluate(**args).truthy? @middle.evaluate(**args) elsif @right @right.evaluate(**args) else ::Code::Object::Nothing.new end end end end end
Version data entries
21 entries across 21 versions & 3 rubygems