scash 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/scash.rb +3 -3
- data/lib/scash/version.rb +1 -1
- data/test/test_scash.rb +11 -2
- 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: 435c9ec1908e446eadcabfbd799e211f4b794831
|
4
|
+
data.tar.gz: 6468a6f6506e6a9788a62e589e2f6c636ab3e603
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 887e1b2094f5b91242fe2a2c17b63de4160db7ec3b76d57c4b66b818e02a2aea356c10cbf674410d0314fef95f9cac9ecb5248c3deb0833bb1ea495281025890
|
7
|
+
data.tar.gz: dcb3e970ee5abd68ade49a25a7b2b13c55bfaea88bebb5482c07191fa2894f317675ccee7a50fb791107adb236455d1b062affccec136202a0ef5e7ef5bf4bc0
|
data/lib/scash.rb
CHANGED
@@ -31,11 +31,11 @@ class Scash
|
|
31
31
|
@inverse_hash.merge!(variables.reject{|key| @inverse_hash.key?(key)})
|
32
32
|
yield
|
33
33
|
ensure
|
34
|
-
variables.
|
35
|
-
variables.
|
34
|
+
variables.each_key{|key| @hash.delete(key)}
|
35
|
+
variables.each_key{|key| @inverse_hash.delete(key)}
|
36
36
|
@inverse_hash.merge!(previous_inverse_hash)
|
37
37
|
@hash.merge!(previous_hash)
|
38
|
-
@hash.merge!(global_variables)
|
38
|
+
@hash.merge!(global_variables.reject { |k| @hash.has_key?(k) })
|
39
39
|
end
|
40
40
|
alias :with :scope
|
41
41
|
|
data/lib/scash/version.rb
CHANGED
data/test/test_scash.rb
CHANGED
@@ -164,6 +164,15 @@ describe Scash do
|
|
164
164
|
scash.define_global_variables :result => 1337
|
165
165
|
assert_equal 1337, scash[:result]
|
166
166
|
|
167
|
+
scash.with(({:result => 1338})) do
|
168
|
+
assert_equal 1338, scash[:result]
|
169
|
+
scash.with(({:result => 1339})) do
|
170
|
+
assert_equal 1339, scash[:result]
|
171
|
+
end
|
172
|
+
assert_equal 1338, scash[:result]
|
173
|
+
end
|
174
|
+
assert_equal 1337, scash[:result]
|
175
|
+
|
167
176
|
scash.with({:b => 2}) do
|
168
177
|
assert_equal 1337, scash[:result]
|
169
178
|
assert_equal 2, scash[:b]
|
@@ -185,7 +194,7 @@ describe Scash do
|
|
185
194
|
scash.define_global_variables :a => 3
|
186
195
|
assert_equal 3, scash[:a]
|
187
196
|
end
|
188
|
-
assert_equal
|
197
|
+
assert_equal 1, scash[:a]
|
189
198
|
end
|
190
199
|
assert_equal 3, scash[:a]
|
191
200
|
end
|
@@ -197,4 +206,4 @@ describe Scash do
|
|
197
206
|
assert_equal({:a => 1, :b => 2}.with_indifferent_access, scash.merge(:b => 2))
|
198
207
|
end
|
199
208
|
end
|
200
|
-
end
|
209
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephan Kaag
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|