class Charyf::Utils::StorageProvider::Memory

Constants

VERSION

Public Class Methods

_instance_map() click to toggle source
# File lib/charyf/utils/storage/memory.rb, line 18
def self._instance_map
  @_instance_map ||= Hash.new
end
get_for(klass) click to toggle source
# File lib/charyf/utils/storage/memory.rb, line 10
def self.get_for(klass)
  name = klass.to_s

  return _instance_map[name] if _instance_map[name]

  _instance_map[name] = self.new(name)
end
new(target) click to toggle source
# File lib/charyf/utils/storage/memory.rb, line 22
def initialize(target)
  @target = target
  @storage = Hash.new
end

Public Instance Methods

get(key) click to toggle source
# File lib/charyf/utils/storage/memory.rb, line 27
def get(key)
  @storage[key]
end
remove(key) click to toggle source
# File lib/charyf/utils/storage/memory.rb, line 38
def remove(key)
  @storage.delete(key)
end
store(key, value) click to toggle source
# File lib/charyf/utils/storage/memory.rb, line 31
def store(key, value)
  old = @storage[key]
  @storage[key] = value

  old
end