gameon-points 0.0.0.pre19 → 0.0.0.pre20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gameon-points/base.rb +11 -10
- 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: 562527a8f208a582a9d05fcd80901b646e0522d5
|
4
|
+
data.tar.gz: 0595abd90fd8c9f4271394100b0bffb3aea7f5c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d80da33ec9740a84fcadf74fb2f3f4d057fc4cb7ae761eb160e8c4d18b6857607f7c45d632c55ef823e00bfe6a0a3d3459a0bffa56d54a1a6afca555d6083aa
|
7
|
+
data.tar.gz: 74f32919e4f9ceec0bb32bc5c2a5c0499f62ed9528097d7a44d6a31367b8be4555d198bd52ddd4d82081fc722c445226ac48d9fbe0178c96c5fe3b67efb24c7d
|
data/lib/gameon-points/base.rb
CHANGED
@@ -11,10 +11,8 @@ GameOn::Env.register do
|
|
11
11
|
end
|
12
12
|
def remove_points value
|
13
13
|
if @points.nil?
|
14
|
-
p "- value"
|
15
14
|
@points = -value
|
16
15
|
else
|
17
|
-
p "- points"
|
18
16
|
@points -= value
|
19
17
|
end
|
20
18
|
end
|
@@ -32,15 +30,18 @@ module GameOn
|
|
32
30
|
end
|
33
31
|
|
34
32
|
def call(env)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
t = Thread.new do
|
34
|
+
if !@params.nil? && @params.has_key?(:add)
|
35
|
+
env[:gameon].add_points(@params[:add] * @opts[:inc_by])
|
36
|
+
#env[:gameon].points = GameOn::Env.add_points(@params[:add] * @opts[:inc_by])
|
37
|
+
#GameOn::Env.add_points(@params[:add] * @opts[:inc_by])
|
38
|
+
end
|
39
|
+
if !@params.nil? && @params.has_key?(:remove)
|
40
|
+
env[:gameon].remove_points(@params[:remove] * @opts[:dec_by])
|
41
|
+
end
|
42
|
+
@app.call(env) # run the next middleware
|
39
43
|
end
|
40
|
-
|
41
|
-
env[:gameon].remove_points(@params[:remove] * @opts[:dec_by])
|
42
|
-
end
|
43
|
-
@app.call(env) # run the next middleware
|
44
|
+
t.join
|
44
45
|
end
|
45
46
|
end
|
46
47
|
end
|