corelib_ruby 1.0.0 → 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/CHANGELOG.md +4 -0
- data/lib/corelib_ruby/core_ext/hash/core.rb +15 -0
- data/lib/corelib_ruby/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: b9f79e6770b7b8f04c389e2412e6a55a4b32d1ab
|
4
|
+
data.tar.gz: 2ab08d58188203325c0b02c17b349ccdf5ac5cf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd6b66a7b6a07e515aa1526b3589b8775bf98b74f390247675d55bdf172c0cf61aec49b15a2c6e610f14e99b9bbe8e50a09c78ee5243bab97b35d407116c8490
|
7
|
+
data.tar.gz: 55a5a574b913b43fc4c59a62d7e33cca1d4e0234bbe1addc3e8b812e952eeeeb8a339de30381c51114819a6d54a95aa3d24bd40304d660145ee5c02c8bb53cec
|
data/CHANGELOG.md
CHANGED
@@ -4,4 +4,19 @@ class Hash
|
|
4
4
|
def cl_not_empty?
|
5
5
|
!empty?
|
6
6
|
end
|
7
|
+
|
8
|
+
# Add an key value if the key doesn't already exist. It will return the
|
9
|
+
# currently set value if the key exists, or the new value if the key doesn't exist.
|
10
|
+
def cl_add_if_absent(key, value)
|
11
|
+
current = self[key]
|
12
|
+
current.nil? ? (self[key] = value) : current
|
13
|
+
end
|
14
|
+
|
15
|
+
# Update a key's value if the key exists. It will return the new value if an update was made, or
|
16
|
+
# nil if the key doesn't exist.
|
17
|
+
def cl_update_if_present(key, value)
|
18
|
+
current = self[key]
|
19
|
+
current.nil? ? nil : (self[key] = value)
|
20
|
+
end
|
21
|
+
|
7
22
|
end
|
data/lib/corelib_ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: corelib_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- roberts1000
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|