Class: Moxie::Store::Object

Inherits:
Moxie::Store show all
Defined in:
lib/moxie/store.rb

Instance Attribute Summary

Attributes inherited from Moxie::Store

#key

Instance Method Summary collapse

Methods inherited from Moxie::Store

#initialize, object, set

Constructor Details

This class inherits a constructor from Moxie::Store

Instance Method Details

#deleteObject



45
46
47
# File 'lib/moxie/store.rb', line 45

def delete
  Moxie.redis.del(key)
end

#save(hash = {}) ⇒ Object



41
42
43
# File 'lib/moxie/store.rb', line 41

def save(hash={})
  Moxie.redis.set(key, hash.to_json)
end

#to_hashObject



32
33
34
35
36
37
38
39
# File 'lib/moxie/store.rb', line 32

def to_hash
  json = Moxie.redis.get(key)
  begin
    JSON.parse(json)
  rescue
    return {}
  end
end