gameon-redis 0.0.0.pre30 → 0.0.0.pre31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gameon-redis/base.rb +20 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 535f9341aec0b21e9b1ba5f84e553829dcc55258
|
4
|
+
data.tar.gz: 2226ad5e3b8f1ea6671cd83efb61af56ba3412e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86287b1b41dbd0ed7b692e1ba5f27115a39839686870db43b34c419263daa322d6981c25172c2b16579922cb82cd92fa81e4dc57c862314f7c6c82f07b874e2d
|
7
|
+
data.tar.gz: 3e428c70c0bf1ca8dd01efba76f4648de5037800f73a2ddf8d1d58b881e56420d186bfc8eb5a37165b542e5f88dd5f54787b4c25934da3e1269ca5468c31d2de
|
data/lib/gameon-redis/base.rb
CHANGED
@@ -4,23 +4,20 @@ require "redis"
|
|
4
4
|
module GameOn
|
5
5
|
module Persistence
|
6
6
|
class DS
|
7
|
-
extend Forwardable
|
7
|
+
#extend Forwardable
|
8
8
|
|
9
9
|
GameOn::Env.register do
|
10
|
-
#class << self
|
11
|
-
# attr_accessor :id
|
12
|
-
#end
|
13
|
-
#@id = @@id
|
14
10
|
attr_accessor :id
|
15
11
|
end
|
16
12
|
|
17
13
|
@@redis = Redis.new
|
18
14
|
|
19
|
-
def_delegator :@gameon_env, :id
|
15
|
+
#def_delegator :@gameon_env, :id
|
20
16
|
def initialize app
|
21
17
|
@app = app
|
22
|
-
|
23
|
-
|
18
|
+
#@gameon_env = GameOn::Env
|
19
|
+
#@id = @gameon_env.id.to_s + 'gameon'
|
20
|
+
@id = GameOn::Env.id.to_s + 'gameon'
|
24
21
|
end
|
25
22
|
|
26
23
|
#def initialize(app)
|
@@ -47,9 +44,21 @@ module GameOn
|
|
47
44
|
end
|
48
45
|
|
49
46
|
def DS.store obj
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
begin
|
48
|
+
@gameon_env = Marshal.dump obj
|
49
|
+
@@redis.set(obj.id, @gameon_env)
|
50
|
+
#rescue SomeExceptionClass => some_variable
|
51
|
+
# code that deals with some exception
|
52
|
+
#rescue SomeOtherException => some_other_variable
|
53
|
+
# code that deals with some other exception
|
54
|
+
else
|
55
|
+
return false
|
56
|
+
# code that runs only if *no* exception was raised
|
57
|
+
ensure
|
58
|
+
p "storing GameOn Env #{obj}"
|
59
|
+
# ensure that this code always runs, no matter what
|
60
|
+
end
|
61
|
+
#return Marshal.load @gameon_env
|
53
62
|
end
|
54
63
|
def DS.load id
|
55
64
|
return Marshal.load @@redis.get @id
|