Sha256: dcb0298dc39863819ab8d813792c4307931ed2474aea64e46cc75fb1e1e79cf5
Contents?: true
Size: 664 Bytes
Versions: 1
Compression:
Stored size: 664 Bytes
Contents
module Gobstones module Lang class TwoArgExpression attr_reader :left_expr, :right_expr def self.evaluates_with(selector) instance_eval do define_method :evaluate do |*args| context = args.first left_expr.evaluate(context) .send(selector, right_expr.evaluate(context)) end end end def initialize(left, right) @left_expr = left @right_expr = right end def ==(other) self.class == other.class && self.left_expr == other.left_expr && self.right_expr == other.right_expr end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gobstones-0.0.1.1 | lib/gobstones/lang/expressions/two_arg_expression.rb |