gameon-points 0.0.0.pre21 → 0.0.0.pre22
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 +4 -4
- 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: 26c8a889aab4a8061c68bb3de6ac8a9a7f126e34
|
4
|
+
data.tar.gz: f04555e0378f72d8ffc3cd51faae86543efdbc1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 893a1101c95c305ff438f14aec635e77b5c2a32b8d1e3b809f5e82bf71ec4533b972ce973bf30a7b4bf9fdcd9cbd32f634b25411a769f06736e1a775b1b160a0
|
7
|
+
data.tar.gz: 5b471d252b2aa0214bf82d9c0e7a38e8e9cd22292deb51247a4a4b1970dcbc90f7df11bb5ca7842560158b8dfbf4cba00a4f41e7ae786e1b088a0fe84a88509b
|
data/lib/gameon-points/base.rb
CHANGED
@@ -2,7 +2,8 @@ GameOn::Env.register do
|
|
2
2
|
@mutex = Mutex.new
|
3
3
|
@mutex.synchronize {
|
4
4
|
attr_accessor :points
|
5
|
-
|
5
|
+
}
|
6
|
+
def add_points value
|
6
7
|
if @points.nil?
|
7
8
|
@points = value
|
8
9
|
else
|
@@ -16,7 +17,6 @@ GameOn::Env.register do
|
|
16
17
|
@points -= value
|
17
18
|
end
|
18
19
|
end
|
19
|
-
}
|
20
20
|
end
|
21
21
|
|
22
22
|
module GameOn
|
@@ -31,12 +31,12 @@ module GameOn
|
|
31
31
|
|
32
32
|
def call(env)
|
33
33
|
t = Thread.new do
|
34
|
-
if !@params.nil? && @params.has_key?(:add)
|
34
|
+
if !@opts.nil? && !@params.nil? && @params.has_key?(:add)
|
35
35
|
env[:gameon].add_points(@params[:add] * @opts[:inc_by])
|
36
36
|
#env[:gameon].points = GameOn::Env.add_points(@params[:add] * @opts[:inc_by])
|
37
37
|
#GameOn::Env.add_points(@params[:add] * @opts[:inc_by])
|
38
38
|
end
|
39
|
-
if !@params.nil? && @params.has_key?(:remove)
|
39
|
+
if !@opts.nil? && !@params.nil? && @params.has_key?(:remove)
|
40
40
|
env[:gameon].remove_points(@params[:remove] * @opts[:dec_by])
|
41
41
|
end
|
42
42
|
@app.call(env) # run the next middleware
|