Sha256: 43457923dadb15afd0e624a886d73844c1d6182fe648bbe40ce8a511b49a8462

Contents?: true

Size: 479 Bytes

Versions: 2

Compression:

Stored size: 479 Bytes

Contents

require_relative 'response'

module Command
  class Not
    def initialize(statement)
      @statement = statement
    end

    def execute(compass, location, tokens)
      response = @statement.execute(compass, location, tokens)
      Response.new(
        compass: response.compass,
        location: response.location,
        operations_count: response.operations_count,
        return_value: !response.return_value,
        tokens: response.tokens
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
karel-interpreter-0.2.0 lib/karel/command/not.rb
karel-interpreter-0.1.0 lib/karel/command/not.rb