Sha256: 279ad617e7aa2b38d6e0692c1e7a522967fef16c35fcdb30670fe2fafe8f2ca1
Contents?: true
Size: 550 Bytes
Versions: 8
Compression:
Stored size: 550 Bytes
Contents
# frozen_string_literal: true module BinaryOperator def evaluate(evaluator, args) if args.is_a? Array args_list = args lhs = args_list.size > 0 ? evaluator.evaluate(args_list[0]) : nil unless lhs.nil? rhs = args_list.size > 1 ? evaluator.evaluate(args_list[1]) : nil unless rhs.nil? return binary(evaluator, lhs, rhs) end end end nil end # @abstract method def binary(evaluator, lhs, rhs) raise NotImplementedError.new("You must implement binary method.") end end
Version data entries
8 entries across 8 versions & 1 rubygems