Class: Sc4ry::Backends::Memory
- Inherits:
-
Object
- Object
- Sc4ry::Backends::Memory
- Defined in:
- lib/sc4ry/backends/memory.rb
Instance Method Summary collapse
- #del(options) ⇒ Object
- #exist?(options) ⇒ Boolean
- #flush ⇒ Object
- #get(options) ⇒ Object
-
#initialize(config = nil?) ) ⇒ Memory
constructor
A new instance of Memory.
- #list ⇒ Object
- #put(options) ⇒ Object
Constructor Details
#initialize(config = nil?) ) ⇒ Memory
Returns a new instance of Memory.
5 6 7 |
# File 'lib/sc4ry/backends/memory.rb', line 5 def initialize(config=nil?) @data = Hash::new end |
Instance Method Details
#del(options) ⇒ Object
21 22 23 |
# File 'lib/sc4ry/backends/memory.rb', line 21 def del() @data.delete [:key] end |
#exist?(options) ⇒ Boolean
29 30 31 |
# File 'lib/sc4ry/backends/memory.rb', line 29 def exist?() return @data.include? [:key] end |
#flush ⇒ Object
25 26 27 |
# File 'lib/sc4ry/backends/memory.rb', line 25 def flush @data.clear end |
#get(options) ⇒ Object
13 14 15 |
# File 'lib/sc4ry/backends/memory.rb', line 13 def get() return @data[[:key]] end |
#list ⇒ Object
9 10 11 |
# File 'lib/sc4ry/backends/memory.rb', line 9 def list return @data.keys end |
#put(options) ⇒ Object
17 18 19 |
# File 'lib/sc4ry/backends/memory.rb', line 17 def put() @data[[:key]] = [:value] end |