gameon-points 0.0.0.pre1 → 0.0.0.pre2
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 +35 -0
- data/lib/gameon-points.rb +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14ff29a639326ceed6bf0777996ba6aecaefc907
|
4
|
+
data.tar.gz: 14600d92a8197801a9bc3899215b7031f0bf2aac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9ce16cf932c5a887b323f01c01335003bf67cf3b61cdce077fa83a32880fdad4a08fb9ffa132e6fa40bc9142aedd692edfe5d865b6c2423e147908e080c88b8
|
7
|
+
data.tar.gz: 2237dacfe48ea77c0363020ce4d2d7b03bd4d64b0744444f815ebc2692ac143373f0cc77aa6859b0c3feaa6669c62cef79ddf06328820194b8caeee5ad09d159
|
@@ -0,0 +1,35 @@
|
|
1
|
+
GameOn::Env.register do
|
2
|
+
attr_accessor :points
|
3
|
+
def add_points value
|
4
|
+
if !@points.nil?
|
5
|
+
@points = @points + value
|
6
|
+
else
|
7
|
+
@points = 0
|
8
|
+
end
|
9
|
+
end
|
10
|
+
def remove_points value
|
11
|
+
if !@points.nil?
|
12
|
+
@points = @points - value
|
13
|
+
else
|
14
|
+
@points = 0
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module GameOn
|
20
|
+
class Points
|
21
|
+
def initialize(app, opts={},params={})
|
22
|
+
@app = app
|
23
|
+
@params = params
|
24
|
+
end
|
25
|
+
def call(env)
|
26
|
+
if @params.has_key?(:add)
|
27
|
+
env[:gameon].add_points @params[:add]
|
28
|
+
end
|
29
|
+
if @params.has_key?(:remove)
|
30
|
+
env[:gameon].remove_points @params[:remove]
|
31
|
+
end
|
32
|
+
@app.call(env) # run the next middleware
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/gameon-points.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gameon-points
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.0.
|
4
|
+
version: 0.0.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- theotherstupidguy
|
@@ -14,30 +14,30 @@ dependencies:
|
|
14
14
|
name: gameon
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - '
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - '
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gameon-redis
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - '
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - '
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0
|
40
|
+
version: '0'
|
41
41
|
description: ''
|
42
42
|
email:
|
43
43
|
- theotherstupidguy@gmail.com
|
@@ -46,6 +46,7 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- lib/gameon-points.rb
|
49
|
+
- lib/gameon-points/base.rb
|
49
50
|
homepage: https://github.com/gameon-rb/gameon-points
|
50
51
|
licenses:
|
51
52
|
- MIT
|