libis-tools 0.9.51 → 0.9.52
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/libis/tools/extend/hash.rb +10 -0
- data/lib/libis/tools/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: d26ba26b0236fcafb2b5ab2b10421792f205b47d
|
4
|
+
data.tar.gz: 333d870d81440b647f102e3694d93809d42e1ff6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaf7b60225b008e68814c5422e4f042d0566f24bf0429967120d5910320b252a45d23c7209736fbe91a41f4d5b08eeff7b450f60cdd4837d6bf3818157a7c0b3
|
7
|
+
data.tar.gz: c96520df9442e1d9e4aac52c466bdcaa49f55c6e0acc19024bba44d4995c45f84fd88bbdf3fb4a7fe0f7e4763b2a6c8fd701ab354c452ebfd2675957787a2ef4
|
@@ -49,6 +49,16 @@ class Hash
|
|
49
49
|
self.merge!(other_hash) {|_,v, _| v}
|
50
50
|
end unless method_defined? :reverse_merge!
|
51
51
|
|
52
|
+
# Apply other hash values if current value is blank
|
53
|
+
def apply_defaults(other_hash)
|
54
|
+
self.merge(other_hash) {|_,v, w| v.blank? ? w : v}
|
55
|
+
end unless method_defined? :apply_defaults
|
56
|
+
|
57
|
+
# Apply in-place other hash values if current value is blank
|
58
|
+
def apply_defaults!(other_hash)
|
59
|
+
self.merge!(other_hash) {|_,v, w| v.blank? ? w : v}
|
60
|
+
end unless method_defined? :apply_defaults!
|
61
|
+
|
52
62
|
# Convert all keys to symbols. In-place operation.
|
53
63
|
# @param (see #key_strings_to_symbols)
|
54
64
|
def key_strings_to_symbols!(options = {})
|
data/lib/libis/tools/version.rb
CHANGED