offs 1.1.3 → 1.2.0

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: 871d2b1af7faae40a4d2145ce5820f890fdf88b5
4
- data.tar.gz: 3d496751487dd3bfe921d0756a9bacdfc470d161
3
+ metadata.gz: 13568710d593b1098f5e5de00b8ed58f69a73b31
4
+ data.tar.gz: ff7e020f519770ee2733e6d85e00519cb78bb456
5
5
  SHA512:
6
- metadata.gz: 5862a48572b882820e151c81521777980f0772050ccc686ab5546b0c6ffc4e31cf6d63f9d812ae0a3df081eb4b65a2a5c155d85e74e99c68dc8e423b0d3b537c
7
- data.tar.gz: 95d0e693eca8ce26cb2f84e112e926990a8fe5a6b353d37c05b38354fcb4cb7be54dbabc5b04b6130613c2c04a473f6b73f7a40a8b402658c14eda0f56186da5
6
+ metadata.gz: 68f264e63bafbd12fb4ff68438b00bcb6d7ef288e8c746c66073fe8dfdf48f775a829905749d6b56d0352a0c0e68c56186cc2e38ac20fe6813371c5adae174b0
7
+ data.tar.gz: bae87536ff2b96f8dc16a38bdeae5f52ecc3aa191acda5db1eb462d82bdf070a757d735ba6b1edf8cd8924a6c0972c34c951f98b28b4e793a9db40bc9c853e56
data/lib/offs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class OFFS
2
- VERSION = "1.1.3"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/offs.rb CHANGED
@@ -10,6 +10,18 @@ class OFFS
10
10
  new(flag).so_you_want_to(&block)
11
11
  end
12
12
 
13
+ def if_you_would_like_to(flag, &block)
14
+ so_you_want_to(flag) do |you|
15
+ you.would_like_to(&block)
16
+ end
17
+ end
18
+
19
+ def if_you_do_not_want_to(flag, &block)
20
+ so_you_want_to(flag) do |you|
21
+ you.may_still_need_to(&block)
22
+ end
23
+ end
24
+
13
25
  def feature_flags
14
26
  Flags.instance.to_a
15
27
  end
data/spec/offs_spec.rb CHANGED
@@ -64,6 +64,22 @@ describe OFFS do
64
64
  expect(do_it).to eq :would_like_to_happened
65
65
  expect(do_it_backwards).to eq :would_like_to_happened
66
66
  end
67
+
68
+ it 'will execute the block for if_you_would_like_to' do
69
+ x = nil
70
+ OFFS.if_you_would_like_to(:my_cool_new_feature) do
71
+ x = 1
72
+ end
73
+ expect(x).to eq 1
74
+ end
75
+
76
+ it 'will not execute the block for if_you_do_not_want_to' do
77
+ x = nil
78
+ OFFS.if_you_do_not_want_to(:my_cool_new_feature) do
79
+ x = 1
80
+ end
81
+ expect(x).to be_nil
82
+ end
67
83
  end
68
84
 
69
85
  context "and the feature is turned off by default" do
@@ -83,6 +99,22 @@ describe OFFS do
83
99
  expect(do_it).to eq :may_still_need_to_happened
84
100
  expect(do_it_backwards).to eq :may_still_need_to_happened
85
101
  end
102
+
103
+ it 'will not execute the block for if_you_would_like_to' do
104
+ x = nil
105
+ OFFS.if_you_would_like_to(:my_cool_new_feature) do
106
+ x = 1
107
+ end
108
+ expect(x).to be_nil
109
+ end
110
+
111
+ it 'will execute the block for if_you_do_not_want_to' do
112
+ x = nil
113
+ OFFS.if_you_do_not_want_to(:my_cool_new_feature) do
114
+ x = 1
115
+ end
116
+ expect(x).to eq 1
117
+ end
86
118
  end
87
119
  end
88
120
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: offs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Wilger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-25 00:00:00.000000000 Z
11
+ date: 2014-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: injectable_dependencies