scash 0.3.0 → 0.3.1
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 +2 -2
- data/lib/scash/version.rb +1 -1
- data/test/test_scash.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4176c2aeb1fef862467a9776c9f3a4524f9c69db
|
4
|
+
data.tar.gz: 40ea5d25325f7a2de15f82d73850bb37a1913dac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1de6938194f4189ee0aa1e060e16b914e9c1d4dcb63477347122ee83afd66ba3a512bb9f6158e6667ba0c3efe3332342244124b064b118093d88818a8c2df506
|
7
|
+
data.tar.gz: df6d5ea94b6b15d583695b953b7e21817b6d7a53e12fa9d749f4936c52e067434c451992b52a0b6a7beee7f0a82f104be100b4f45c49fff7b36aa9ab01e6c67c
|
data/lib/scash.rb
CHANGED
@@ -34,9 +34,9 @@ class Scash
|
|
34
34
|
ensure
|
35
35
|
variables.keys.each{|key| @hash.delete(key)}
|
36
36
|
variables.keys.each{|key| @inverse_hash.delete(key)}
|
37
|
-
@hash.merge!(@global_variables)
|
38
37
|
@inverse_hash.merge!(previous_inverse_hash)
|
39
38
|
@hash.merge!(previous_hash)
|
39
|
+
@hash.merge!(@global_variables)
|
40
40
|
end
|
41
41
|
alias :with :scope
|
42
42
|
|
@@ -54,7 +54,7 @@ class Scash
|
|
54
54
|
|
55
55
|
def define_global_variables(variables)
|
56
56
|
@hash.merge! variables
|
57
|
-
@global_variables.merge!
|
57
|
+
@global_variables.merge! variables
|
58
58
|
end
|
59
59
|
|
60
60
|
private
|
data/lib/scash/version.rb
CHANGED
data/test/test_scash.rb
CHANGED
@@ -179,6 +179,15 @@ describe Scash do
|
|
179
179
|
|
180
180
|
assert_equal "foo", scash[:result]
|
181
181
|
assert_equal "bar", scash[:b]
|
182
|
+
|
183
|
+
scash.with({:a => 1}) do
|
184
|
+
scash.with({:a => 2}) do
|
185
|
+
scash.define_global_variables :a => 3
|
186
|
+
assert_equal 3, scash[:a]
|
187
|
+
end
|
188
|
+
assert_equal 3, scash[:a]
|
189
|
+
end
|
190
|
+
assert_equal 3, scash[:a]
|
182
191
|
end
|
183
192
|
end
|
184
193
|
|