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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b618eaee8c3da99ef200b68c1220b751c7a4ff0
4
- data.tar.gz: 287efb45bd21aad8fcdcbba3308a4cce608d92a2
3
+ metadata.gz: 14ff29a639326ceed6bf0777996ba6aecaefc907
4
+ data.tar.gz: 14600d92a8197801a9bc3899215b7031f0bf2aac
5
5
  SHA512:
6
- metadata.gz: 9bb0118e737319b0131cc2484ec7d3b60aef19a7f6b256c60b2b4cc35211895127e2fac1e1b653752fc04a0f1df0d9564a09d77cac1b4990b1434b60d150ab30
7
- data.tar.gz: 51ca938241b412fd76d0f9a843001b4d55c6729cc78f3f3bd80aa744762d4836393e8f0f3c7a1b734a74b45eff248c08763ba367a3bc038bf83363b56c42af92
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
@@ -1,4 +1,4 @@
1
1
  require 'gameon'
2
2
  require 'gameon-redis'
3
3
 
4
- require_relative './gameon-points/base'
4
+ require 'gameon-points/base'
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.pre1
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.0.0.pre1
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.0.0.pre1
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.0.0.pre1
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.0.0.pre1
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