featurer 0.0.2 → 0.0.3

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: 7b97e2798a4d151dd21789e1b07495668a9106eb
4
- data.tar.gz: 5e66cac3b6cdbc88d2e391f95254238203658b54
3
+ metadata.gz: 6cb600d87fa0d7bb593241b52b70d13b563a61f6
4
+ data.tar.gz: 5381460ea6488704484711d075b1d72357dc1c62
5
5
  SHA512:
6
- metadata.gz: b262a88beb438f0bc5a7aed3e26682e6c2ae6a1860794e0a585aed18c6fb82c14eb505ae78011ed57496361eb0e8c60f2bd2ae8378001dd0098c2917cc917bfe
7
- data.tar.gz: 6d88f59f48f5193200585ca0669ba49d1e7487156b1227371964bf080702ab8dad3abdcd268d457b4e09edc5d54e12b189fdebf9009e3bd4f39f08eb9322ffc3
6
+ metadata.gz: d9fb938b9f5df59f8b71332d481b03845f3c6bd4179aa1619b7523002cc91c486240a8f40d0e0d29facbf5b811543b3740d751510725d4cb823deba64fc92260
7
+ data.tar.gz: 987eaefaaa92f73309581fa25a07286648613779a670651069f31ab8bda47c13809fc6d633e8167e8a3eed8c03685b7e9884fdc317a5a942798e4f5059492b15
data/.travis.yml CHANGED
@@ -5,6 +5,7 @@ rvm:
5
5
  - 2.1.0
6
6
  - 2.1.1
7
7
  - 2.1.2
8
+ - 2.1.3
8
9
  services:
9
10
  - redis-server
10
11
  bundler_args: --without debug
data/README.md CHANGED
@@ -52,7 +52,7 @@ Featurer.init
52
52
  For different users:
53
53
 
54
54
  ```ruby
55
- Featurer.register(:feature, [first_user_id, sercond_users_id, third_user_id])
55
+ Featurer.register(:feature, [first_user_id, second_user_id, third_user_id])
56
56
  ```
57
57
 
58
58
  or single:
@@ -67,6 +67,12 @@ Then request the enabled feature:
67
67
  Featurer.on?(:feature, user_id)
68
68
  ```
69
69
 
70
+ In order to remove a user from a feature:
71
+
72
+ ```ruby
73
+ Featurer.off(:feature, user_id)
74
+ ```
75
+
70
76
  #### Global feature
71
77
 
72
78
  ```ruby
@@ -79,6 +85,12 @@ Then request the enabled feature:
79
85
  Featurer.on? :feature
80
86
  ```
81
87
 
88
+ In order to remove multiple users from a feature:
89
+
90
+ ```ruby
91
+ Featurer.off(:feature, [first_user_id, second_user_id])
92
+ ```
93
+
82
94
  #### Deleting features
83
95
 
84
96
  ```ruby
@@ -18,6 +18,10 @@ module Featurer
18
18
  fetch_from_set(feature, value)
19
19
  end
20
20
 
21
+ def off(feature, value)
22
+ remove_from_set(feature, value)
23
+ end
24
+
21
25
  def register(name, value = true)
22
26
  # ensure old data is wiped
23
27
  delete(name)
@@ -41,5 +45,9 @@ module Featurer
41
45
  def fetch_from_set(name, id)
42
46
  @redis.sismember(key(name), id)
43
47
  end
48
+
49
+ def remove_from_set(name, id)
50
+ @redis.srem(key(name), id)
51
+ end
44
52
  end
45
53
  end
@@ -1,3 +1,3 @@
1
1
  module Featurer
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -34,6 +34,22 @@ describe Featurer do
34
34
  expect(Featurer.on?(:feature)).to be
35
35
  expect(Featurer.on?(:feature, user_id)).to_not be
36
36
  end
37
+
38
+ it 'should remove a single user from the feature' do
39
+ Featurer.register :feature, [user_id, user_id + 1]
40
+ Featurer.off :feature, user_id
41
+
42
+ expect(Featurer.on?(:feature, user_id)).to_not be
43
+ expect(Featurer.on?(:feature, user_id + 1)).to be
44
+ end
45
+
46
+ it 'should remove a multiple users from the feature' do
47
+ Featurer.register :feature, [user_id, user_id + 1]
48
+
49
+ Featurer.off :feature, [user_id, user_id + 1]
50
+ expect(Featurer.on?(:feature, user_id)).to_not be
51
+ expect(Featurer.on?(:feature, user_id + 1)).to_not be
52
+ end
37
53
  end
38
54
 
39
55
  describe 'global' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: featurer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro El Informatico
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-29 00:00:00.000000000 Z
11
+ date: 2014-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis