Sha256: c5ede85766bf6b777b26d117df04a71a97f0f8c05f4afbbd2084583ddb31a84a

Contents?: true

Size: 526 Bytes

Versions: 1

Compression:

Stored size: 526 Bytes

Contents

module Gobstones

  module Lang

    class SingleAssignment

      attr_reader :var_name, :expression

      def initialize(var_name, expression)
        @var_name, @expression = var_name, expression
      end

      def ==(other)
        self.class == other.class &&
        self.var_name == other.var_name &&
        self.expression == other.expression
      end

      def evaluate(context)
        context.set var_name, expression.evaluate(context)
      end

    end

    # TODO implement multiple assignment

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gobstones-0.0.1.1 lib/gobstones/lang/commands/assignments.rb