var_block 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/var_block/globals.rb +1 -1
- data/lib/var_block/var_hash.rb +7 -5
- data/lib/var_block/version.rb +1 -1
- 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: b5eff5e3d3eabecc4648ffda2370f50e17b2d4ab
|
4
|
+
data.tar.gz: 9843dd46c637d96897b68f99bec939cbc2d8015c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dd22cc5fe605b40680407df3cd704f637d7a8774c54bcbb5ee15578ea365220d7126b4236618f5211c7e2065d9521debf85112edd5c2e4a883c8db2efbdb6c2
|
7
|
+
data.tar.gz: f65d3d1e7eb077ef7d0f6a8e8a71e846c6ae5feffa201ed1abd52d8c587262bdca278c087c0617b1d3e05273bd6230101b72fc39ccc1e365d25d5fee3a5b0c4d
|
data/lib/var_block/globals.rb
CHANGED
data/lib/var_block/var_hash.rb
CHANGED
@@ -6,18 +6,20 @@ module VarBlock
|
|
6
6
|
include VarBlock::Globals
|
7
7
|
include VarBlock::Support
|
8
8
|
|
9
|
-
def
|
9
|
+
def self.new_from_var_hash(var_hash: nil)
|
10
|
+
new_var_hash = VarHash.new
|
10
11
|
if var_hash
|
11
12
|
raise ArgumentError.new('`instance` should be a `VarHash` object') unless var_hash.is_a? VarHash
|
12
|
-
|
13
|
+
new_var_hash = new_var_hash.merge!(var_hash.to_h)
|
13
14
|
end
|
14
|
-
|
15
|
+
new_var_hash
|
15
16
|
end
|
16
17
|
|
17
18
|
def with(variables = {})
|
18
19
|
super(self, variables)
|
19
20
|
end
|
20
21
|
|
22
|
+
# OVERRIDES Hash `merge`
|
21
23
|
def merge(variables)
|
22
24
|
raise ArgumentError, '`merge` does not accept a block. Are you looking for `merged_with` instead?' if block_given?
|
23
25
|
|
@@ -27,9 +29,9 @@ module VarBlock
|
|
27
29
|
# if variable already has a value, we need to wrap both values into a VarArray if not yet a VarArray
|
28
30
|
if self.has_key?(key)
|
29
31
|
unless current_value.is_a? VarArray
|
30
|
-
self[key] = VarArray.new(array_wrap(current_value) + array_wrap(value))
|
32
|
+
self[key] = VarArray.new(array_wrap(current_value) + array_wrap(value))
|
31
33
|
else
|
32
|
-
self[key].concat(array_wrap(value))
|
34
|
+
self[key] = self[key].clone.concat(array_wrap(value))
|
33
35
|
end
|
34
36
|
|
35
37
|
# else if new variable
|
data/lib/var_block/version.rb
CHANGED