Class: Nestene::MemoryStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/nestene/storage.rb

Instance Method Summary collapse

Constructor Details

#initializeMemoryStorage

Returns a new instance of MemoryStorage.



65
66
67
# File 'lib/nestene/storage.rb', line 65

def initialize
  @storage = {}
end

Instance Method Details

#delete(key) ⇒ Object



85
86
87
# File 'lib/nestene/storage.rb', line 85

def delete(key)
  @storage.delete(key)
end

#listObject



69
70
71
# File 'lib/nestene/storage.rb', line 69

def list
  @storage.keys
end

#load(key) ⇒ Object



73
74
75
# File 'lib/nestene/storage.rb', line 73

def load(key)
  @storage[key]
end

#store(key, value) ⇒ Object



77
78
79
80
81
82
83
# File 'lib/nestene/storage.rb', line 77

def store(key, value)
  if value != nil
    @storage[key] = value
  else
    delete(key)
  end
end