material 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efcfabbcb8f6616b00911cd7da974ddd02eb89f717a0eb5a4f5572993173e53e
4
- data.tar.gz: f09dd51e177bb86b3904617275f164286c4e54d0df866f745171206eb9169802
3
+ metadata.gz: f2bfa3f32901451e69e88fa370ef2ff8f3add861df3551864683badfd59452cc
4
+ data.tar.gz: ce590b13773298904f7bf0d014c6f3ce0d030a391b6f36c75219e16a2ea1aa9e
5
5
  SHA512:
6
- metadata.gz: 9a8c4aa9c9ee2771f51147b995f06a28ac8cc6f10db4aaa0838d3c293f2a544e8ca5b6d9725050c8f03ec073d1749fb6d8a4ea424924b170c295f211e2ca4f9b
7
- data.tar.gz: ec9856c4e6aa60d81ecd706e02b625b57038018deae73451b6435c705f69ea819bc32c114680848423bb8c9e461c06d33ceee8da9017a2eed302d58c3c08642d
6
+ metadata.gz: 6d755826933146b93891da1dd1a839bae456438100db94d8d81b2078ed9a11c1646a684d40181e21d5d395bedebdae2225ba364799c642f25cefc1a05e405056
7
+ data.tar.gz: b224702ae9b686495526de08e38ff13e3516e64dd34fcaa4652ec3d9eb690151b4bc0a45d2bb5842f75f1ce4c20e0824bdd43d6de87886094e573df60d70a6ad
@@ -5,11 +5,17 @@ module Material
5
5
  module For
6
6
  extend ActiveSupport::Concern
7
7
 
8
- LOOKUP_NAME = :material_class
9
-
10
8
  class_methods do
11
9
  def material_class_for(object, subtype)
12
- object.try(LOOKUP_NAME) || object.class.try(LOOKUP_NAME) || "#{object.class.name}#{subtype}".safe_constantize
10
+ method = "#{subtype.downcase}_class".to_sym
11
+ object_class = object.is_a?(Class) ? object : object.class
12
+ lookup(object, method) || lookup(object_class, method) || "#{object_class.name}#{subtype}".safe_constantize
13
+ end
14
+
15
+ private
16
+
17
+ def lookup(object, lookup_name)
18
+ object.public_send(lookup_name) if object.respond_to?(lookup_name)
13
19
  end
14
20
  end
15
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Material
4
- VERSION = "0.2.6"
4
+ VERSION = "0.2.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: material
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Garside
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-10 00:00:00.000000000 Z
11
+ date: 2019-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.15.1
33
+ version: 0.16.2
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
36
  version: '1.0'
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 0.15.1
43
+ version: 0.16.2
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '1.0'
@@ -148,7 +148,7 @@ dependencies:
148
148
  requirements:
149
149
  - - ">="
150
150
  - !ruby/object:Gem::Version
151
- version: 0.15.1
151
+ version: 0.16.2
152
152
  - - "<"
153
153
  - !ruby/object:Gem::Version
154
154
  version: '1.0'
@@ -158,7 +158,7 @@ dependencies:
158
158
  requirements:
159
159
  - - ">="
160
160
  - !ruby/object:Gem::Version
161
- version: 0.15.1
161
+ version: 0.16.2
162
162
  - - "<"
163
163
  - !ruby/object:Gem::Version
164
164
  version: '1.0'
@@ -168,7 +168,7 @@ dependencies:
168
168
  requirements:
169
169
  - - ">="
170
170
  - !ruby/object:Gem::Version
171
- version: 0.15.1
171
+ version: 0.16.2
172
172
  - - "<"
173
173
  - !ruby/object:Gem::Version
174
174
  version: '1.0'
@@ -178,7 +178,7 @@ dependencies:
178
178
  requirements:
179
179
  - - ">="
180
180
  - !ruby/object:Gem::Version
181
- version: 0.15.1
181
+ version: 0.16.2
182
182
  - - "<"
183
183
  - !ruby/object:Gem::Version
184
184
  version: '1.0'