Sha256: e353b22804823b710d072e61ffaf790d656ec89d96caffdeacc36ef9c589345b
Contents?: true
Size: 615 Bytes
Versions: 32
Compression:
Stored size: 615 Bytes
Contents
# frozen_string_literal: true class Code class Node class Ternary < Node def initialize(parsed) @left = Node::Statement.new(parsed.delete(:left)) @middle = Node::Statement.new(parsed.delete(:middle)) @right = Node::Statement.new(parsed.delete(:right)) if parsed.key?( :right ) 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
32 entries across 32 versions & 1 rubygems