class MemoryStorage

Constants

VERSION

Public Class Methods

all() click to toggle source
# File lib/memory_storage.rb, line 19
def all
  storage.values
end
each(&block) click to toggle source
# File lib/memory_storage.rb, line 23
def each(&block)
  storage.values.each &block
end
find(identifier) click to toggle source
# File lib/memory_storage.rb, line 11
def find(identifier)
  storage[identifier]
end
flush() click to toggle source
# File lib/memory_storage.rb, line 15
def flush
  @storage = {}
end
save(object, identifier_method = :id) click to toggle source
# File lib/memory_storage.rb, line 7
def save(object, identifier_method = :id)
  storage[object.send identifier_method] = object
end
storage() click to toggle source
# File lib/memory_storage.rb, line 27
def storage
  @storage ||= {}
end