switch_point 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/switch_point/model.rb +15 -3
- data/lib/switch_point/version.rb +1 -1
- data/spec/switch_point/model_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80333b18b169594e3d1439b08df9cff562f85eff
|
4
|
+
data.tar.gz: 9d701fc245dc24a8f1736d4d0adad9bf920de04b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4ab8f26f462b8bdb96c97c7f39e3bd20befc4c0d94445b7c9bf3f349c06d0218bc6b314ed2ecd6435c5055cff9aaaced2d2e688a7a8d7a6c5299baf1533cb82
|
7
|
+
data.tar.gz: 5eaf795923f263f0caa615baec1f6687e8c834c80842925cb4a50fca10eb568977dc795d9704edefe7da145f5c8712ad53cb3ec4398e9eee4728025058464c38
|
data/CHANGELOG.md
CHANGED
data/lib/switch_point/model.rb
CHANGED
@@ -19,11 +19,19 @@ module SwitchPoint
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def with_readonly(&block)
|
22
|
-
switch_point_proxy
|
22
|
+
if switch_point_proxy
|
23
|
+
switch_point_proxy.with_readonly(&block)
|
24
|
+
else
|
25
|
+
block.call
|
26
|
+
end
|
23
27
|
end
|
24
28
|
|
25
29
|
def with_writable(&block)
|
26
|
-
switch_point_proxy
|
30
|
+
if switch_point_proxy
|
31
|
+
switch_point_proxy.with_writable(&block)
|
32
|
+
else
|
33
|
+
block.call
|
34
|
+
end
|
27
35
|
end
|
28
36
|
|
29
37
|
def use_switch_point(name)
|
@@ -32,7 +40,11 @@ module SwitchPoint
|
|
32
40
|
end
|
33
41
|
|
34
42
|
def switch_point_proxy
|
35
|
-
|
43
|
+
if @switch_point_name
|
44
|
+
ProxyRepository.checkout(@switch_point_name)
|
45
|
+
else
|
46
|
+
nil
|
47
|
+
end
|
36
48
|
end
|
37
49
|
|
38
50
|
private
|
data/lib/switch_point/version.rb
CHANGED
@@ -122,6 +122,12 @@ RSpec.describe SwitchPoint::Model do
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
125
|
+
|
126
|
+
context 'without use_switch_point' do
|
127
|
+
it 'bypasses given block' do
|
128
|
+
expect(Note.with_writable { :bypass }).to eq(:bypass)
|
129
|
+
end
|
130
|
+
end
|
125
131
|
end
|
126
132
|
|
127
133
|
describe '.with_readonly' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: switch_point
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kohei Suzuki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|