Sha256: 5287eb0a13b0f8640ee3f90e8d2326ecc95b9727ed6677afd878c98ccbf57222

Contents?: true

Size: 324 Bytes

Versions: 1

Compression:

Stored size: 324 Bytes

Contents

module Whitespace
  class Memory
    def initialize
      @store = {}
    end

    def [](address)
      if @store.key?(address)
        @store[address]
      else
        raise AddressError, "no such address exists: #{address}"
      end
    end

    def []=(address, value)
      @store[address] = value
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whitespace-ruby-1.0.0 lib/whitespace/data_structures/memory.rb