structish 0.1.1 → 0.2.1
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/validations.rb +12 -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: bb8375ce872710c3e8110f8a828634a250eb511edb287cec4727bd164b5e6603
|
4
|
+
data.tar.gz: 188c37b662cb237aae784d8c1e13092d704db44ce919e3db39134164de7bb8f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86939b735cdb7ccb5d5b23235591bcd5fb9489605e642484775a516fad253fc5d24bca7ddf3c94221bc59954d4fb32fe3a579de704a4546f105162eb1f9e6749
|
7
|
+
data.tar.gz: c50734865d6eef701c9cda85e765c715dbdf90d0c69764800162cf5b445812e7d4222c5a1ed28eabbabc8d740aa1d3a45ae9c900e7646b68a1136fcf2c58c15f
|
@@ -160,10 +160,22 @@ module Structish
|
|
160
160
|
end || []
|
161
161
|
end
|
162
162
|
|
163
|
+
def attribute_values
|
164
|
+
if self.class < Array
|
165
|
+
self.to_a.values_at(*self.class.attribute_keys)
|
166
|
+
elsif self.class < Hash
|
167
|
+
self.to_h.slice(*self.class.attribute_keys)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
163
171
|
end
|
164
172
|
|
165
173
|
module ClassMethods
|
166
174
|
|
175
|
+
def attribute_keys
|
176
|
+
attributes.map { |attribute| attribute[:key] }
|
177
|
+
end
|
178
|
+
|
167
179
|
def structish?
|
168
180
|
true
|
169
181
|
end
|
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.2.1
|
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-01
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|