Sha256: 200fb641da296f2d17583a60fd32f8c452211613acf8751f9e0ec1404d58b9b9

Contents?: true

Size: 423 Bytes

Versions: 1

Compression:

Stored size: 423 Bytes

Contents

require 'gobstones/lang/expressions/one_arg_expression'

module Gobstones

  module Lang

    class Mover < OneArgExpression

      def evaluate(context)
        with_evaluated_argument_in(context) do |result|
          context.head.move result
        end
      end

      def undo(context)
        opposite.evaluate context
      end

      def opposite
        Mover.new argument.opposite
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gobstones-0.0.2 lib/gobstones/lang/commands/mover_cmd.rb