rolex 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +3 -1
  2. data/lib/rolex.rb +6 -4
  3. data/lib/rolex/version.rb +1 -1
  4. metadata +6 -6
data/README.md CHANGED
@@ -27,7 +27,9 @@ Roles can be anything you like.
27
27
 
28
28
  ## TODO
29
29
 
30
- Add tests!
30
+ * Add tests!
31
+ * Configure Redis properly (currently relies on how I like to define Redis in my Rails apps)
32
+ * Make framework agnostic
31
33
 
32
34
  ## Installation
33
35
 
@@ -5,21 +5,23 @@ require "rolex/version"
5
5
  module Rolex
6
6
  extend ActiveSupport::Concern
7
7
 
8
+ SUFFIX = ENV['RAILS_ENV'] || 'development'
9
+
8
10
  included do
9
11
  def add_role(role)
10
- Redis.current.sadd "user:#{id}:rolex:#{ENV['RAILS_ENV']}", role.to_s
12
+ Redis.current.sadd "user:#{id}:rolex:#{SUFFIX}", role.to_s
11
13
  end
12
14
 
13
15
  def has_role?(role)
14
- Redis.current.smembers("user:#{id}:rolex:#{ENV['RAILS_ENV']}").include? role.to_s
16
+ Redis.current.smembers("user:#{id}:rolex:#{SUFFIX}").include? role.to_s
15
17
  end
16
18
 
17
19
  def roles
18
- Redis.current.smembers("user:#{id}:rolex:#{ENV['RAILS_ENV']}")
20
+ Redis.current.smembers("user:#{id}:rolex:#{SUFFIX}")
19
21
  end
20
22
 
21
23
  def remove_role(role)
22
- Redis.current.srem "user:#{id}:rolex:#{ENV['RAILS_ENV']}", role.to_s
24
+ Redis.current.srem "user:#{id}:rolex:#{SUFFIX}", role.to_s
23
25
  end
24
26
  end
25
27
  end
@@ -1,3 +1,3 @@
1
1
  module Rolex
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rolex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-12 00:00:00.000000000 Z
12
+ date: 2013-05-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70162146503040 !ruby/object:Gem::Requirement
16
+ requirement: &70270640207960 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70162146503040
24
+ version_requirements: *70270640207960
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70162146502620 !ruby/object:Gem::Requirement
27
+ requirement: &70270640205340 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70162146502620
35
+ version_requirements: *70270640205340
36
36
  description: ! 'Rolex: simple roles, backed by redis'
37
37
  email:
38
38
  - electronicbattleweapon7@gmail.com