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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afb3c105339a4820c5d2fe359594bd710f7bace6
4
- data.tar.gz: 06965713698f73c8da9eab643e4d5ae73aa4d167
3
+ metadata.gz: 435c9ec1908e446eadcabfbd799e211f4b794831
4
+ data.tar.gz: 6468a6f6506e6a9788a62e589e2f6c636ab3e603
5
5
  SHA512:
6
- metadata.gz: 7551bb81e9e0ca26bde47cf371e891172d19e18397175560febd0b429578f4e8645246c3f9437f70766e6aac357edb75ea4834c94379a749b3657ab83992c070
7
- data.tar.gz: ed4217efe76a8978e28335ccea253726dbaaf06dc49b1c18310f06a1d53196920d39f58e89a80ac5ff7c0c65678e254af36208cc84c04d10573d25a83c977dc6
6
+ metadata.gz: 887e1b2094f5b91242fe2a2c17b63de4160db7ec3b76d57c4b66b818e02a2aea356c10cbf674410d0314fef95f9cac9ecb5248c3deb0833bb1ea495281025890
7
+ data.tar.gz: dcb3e970ee5abd68ade49a25a7b2b13c55bfaea88bebb5482c07191fa2894f317675ccee7a50fb791107adb236455d1b062affccec136202a0ef5e7ef5bf4bc0
@@ -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.keys.each{|key| @hash.delete(key)}
35
- variables.keys.each{|key| @inverse_hash.delete(key)}
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
 
@@ -1,3 +1,3 @@
1
1
  class Scash
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -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 3, scash[:a]
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.2
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: 2014-09-26 00:00:00.000000000 Z
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport