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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bc52b972b081a69479e5406a733c7374a725b275e8db0dad081d30eabd0fba5
4
- data.tar.gz: f244b3bfb2e1d4b59ab985240e61e64f8f1730091de57e9e0f219c2d8e1ee236
3
+ metadata.gz: bb8375ce872710c3e8110f8a828634a250eb511edb287cec4727bd164b5e6603
4
+ data.tar.gz: 188c37b662cb237aae784d8c1e13092d704db44ce919e3db39134164de7bb8f5
5
5
  SHA512:
6
- metadata.gz: eff36ee49e66cc34660a29d4ffe82e1561c29de8adb7b98ab896fcc15c99c236758463289725336c63236ba1abba5a155ec988ed7511e42235e99c86bef5ba74
7
- data.tar.gz: 30086ab0aa74750fbf08079b8e8e5f0ea1611036301577474b5aaf656bbf8512a3633e893e9e694032843617cfc0f6b816c4b9874051e668b4d5361b28d1ec31
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
@@ -1,3 +1,3 @@
1
1
  module Structish
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.1"
3
3
  end
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.1.1
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-29 00:00:00.000000000 Z
11
+ date: 2021-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport