var_block 1.0.8 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/var_block/globals.rb +2 -2
- data/lib/var_block/var_hash.rb +6 -7
- data/lib/var_block/version.rb +1 -1
- 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: 52500dddb01957bd7bb27a4bd350eae5561f5d95
|
|
4
|
+
data.tar.gz: 49ced4748df76620efe0c004d5a64ac860393265
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ef3e539293ec016b650cf31241f5963c071b5b4e132cfefe81a5fcac0681fa54a17127536ed700ea12b898619c4aec7384eb26a9222c3f04dee6b98243e3bf9
|
|
7
|
+
data.tar.gz: 6db49ae3b929ddebf69da7744188b0c73f71f73cce814cb2200119f4a757b36c4065dab73da7eace2c3a954cf8f0a1ca4eb6693e0af3d1bf2b902710d0c49af2
|
data/lib/var_block/globals.rb
CHANGED
|
@@ -11,7 +11,7 @@ module VarBlock
|
|
|
11
11
|
base.extend self
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def
|
|
14
|
+
def varblock_get(var_hash, index, *options)
|
|
15
15
|
unsupported_options = (options - VarBlock::GetvarHandlers::OPTIONS)
|
|
16
16
|
raise ArgumentError, "3rd argument options Array only supports #{VarBlock::GetvarHandlers::OPTIONS}. Does not support #{unsupported_options.map(&:inspect).join(', ')}" if unsupported_options.any?
|
|
17
17
|
raise ArgumentError, "1st argument should be a VarHash object, but is found to be a #{var_hash.class}" unless var_hash.is_a? VarHash
|
|
@@ -31,7 +31,7 @@ module VarBlock
|
|
|
31
31
|
return_value
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def
|
|
34
|
+
def varblock_with(var_hash_parent = nil, **variables)
|
|
35
35
|
var_hash = VarHash.new_from_var_hash(var_hash: var_hash_parent)
|
|
36
36
|
|
|
37
37
|
variables.each do |key, value|
|
data/lib/var_block/var_hash.rb
CHANGED
|
@@ -15,13 +15,12 @@ module VarBlock
|
|
|
15
15
|
new_var_hash
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def
|
|
18
|
+
def varblock_with(variables = {})
|
|
19
19
|
super(self, variables)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
raise ArgumentError, '`merge` does not accept a block. Are you looking for `merged_with` instead?' if block_given?
|
|
22
|
+
def varblock_merge(variables)
|
|
23
|
+
raise ArgumentError, '`varblock_merge` does not accept a block. Are you looking for `varblock_merged_with` instead?' if block_given?
|
|
25
24
|
|
|
26
25
|
variables.each do |key, value|
|
|
27
26
|
current_value = self[key]
|
|
@@ -41,10 +40,10 @@ module VarBlock
|
|
|
41
40
|
end
|
|
42
41
|
end
|
|
43
42
|
|
|
44
|
-
def
|
|
43
|
+
def varblock_merged_with(variables = {})
|
|
45
44
|
cloned_self = self.clone
|
|
46
|
-
cloned_self.
|
|
47
|
-
cloned_self.
|
|
45
|
+
cloned_self.varblock_merge(variables)
|
|
46
|
+
cloned_self.varblock_with() { yield(cloned_self) }
|
|
48
47
|
end
|
|
49
48
|
end
|
|
50
49
|
end
|
data/lib/var_block/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: var_block
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jules Roman B. Polidario
|
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
94
94
|
version: '0'
|
|
95
95
|
requirements: []
|
|
96
96
|
rubyforge_project:
|
|
97
|
-
rubygems_version: 2.
|
|
97
|
+
rubygems_version: 2.6.11
|
|
98
98
|
signing_key:
|
|
99
99
|
specification_version: 4
|
|
100
100
|
summary: DSL for variable scoping / encapsulation for readability and organisation,
|