structish 0.2.4 → 0.3.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/structish/array.rb +5 -1
- data/lib/structish/hash.rb +1 -0
- data/lib/structish/validations.rb +8 -0
- data/lib/structish/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6d2ba1a7e8fe1d6239b90627d5be7a5ffabae2ec8ed55f075d6794d5bcc387c
|
4
|
+
data.tar.gz: 11bcd0b789e9cf61dea899a3d2eb397e36eee39474054da8580ea4fe1c19a261
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8445eb56faec25e23b09ab4ad2040b3906f313b3e948f27554ba209a200f1e15de6e4fe7a6d32ca5ba2aed0adbaa7a395263ea4a50c964125e4d85b6273d0bb
|
7
|
+
data.tar.gz: 16abf2097b0755ad04fd0783cf9a420cd384cfe82ec7336c182952cc5a272c047e3546923a6ceac2878f470c9ccbf2e4a96d001e9c304f514e467730935e5d82
|
data/lib/structish/array.rb
CHANGED
@@ -6,7 +6,11 @@ module Structish
|
|
6
6
|
def initialize(constructor)
|
7
7
|
raise(ArgumentError, "Only array-like objects can be used as constructors for Structish::Array") unless constructor.class <= ::Array
|
8
8
|
validate_structish(constructor)
|
9
|
-
|
9
|
+
if self.class.compact?
|
10
|
+
super(constructor.compact)
|
11
|
+
else
|
12
|
+
super(constructor)
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
16
|
def <<(entry)
|
data/lib/structish/hash.rb
CHANGED
@@ -9,6 +9,7 @@ module Structish
|
|
9
9
|
constructor = self.class.symbolize? ? raw_constructor.symbolize_keys : raw_constructor
|
10
10
|
hash = constructor.to_h
|
11
11
|
validate_structish(hash)
|
12
|
+
hash = hash.compact if self.class.compact?
|
12
13
|
super()
|
13
14
|
update(hash)
|
14
15
|
self.default = hash.default if hash.default
|
data/lib/structish/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: structish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Blakemore
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|