material 0.2.10 → 0.2.11

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: 32abc9198a5a231e3e5008996d931136e4c73426e3fb7fcc7c9aea25b18d3cc2
4
- data.tar.gz: cb6a8eb11ce1959c72a780eb9907f56d1587b3a29502618af04210779c67aa00
3
+ metadata.gz: ed245f0f0fe5e5166138014bd4a4b9d25be10f8d6962b07933ddb8759fda864f
4
+ data.tar.gz: 92c654d62c960e15fdc7d500ab8d9c1fc9424593fea193cee138ef77349bbd11
5
5
  SHA512:
6
- metadata.gz: c7b1d83ad37b0a4a813535aa5ba9bc57c9408dbeda48a232e107bd068578a84a6f349d7f85c9038b93facde4d22562782f8d8db690be694fd0db2a3b70ff2924
7
- data.tar.gz: d10d8242b61827299005f3e37b10b45d7a8ba0a818f436798220e090b126d643b3730d7b6b4b19334263bf15fc573c737b042f9cb5df69e9f0028b318386e1d1
6
+ metadata.gz: 35d9dd166b68b9a25616c9683d0f61bb4cfb521f9f1890d49578b9cea51077bf801781e414c8425e30007a022d8b4f4c677ff797943d4d28a425beb051fac636
7
+ data.tar.gz: 568a26a8db39af7e74eae8d096b1de1a6df0dc0d712a964f7389827835534efdd0b89cf50a68bf4e46482787682827f8cef281614c30b0e157316c0d4585adcd
data/lib/material/list.rb CHANGED
@@ -14,9 +14,26 @@ module Material
14
14
  include Material::Pagination
15
15
  include Material::Mount
16
16
 
17
- def self.for(object)
18
- material_class = material_class_for(object, "List")
19
- material_class.new if material_class.present?
17
+ class << self
18
+ def for(object)
19
+ material_class = material_class_for(object, "List")
20
+ material_class.new if material_class.present?
21
+ end
22
+
23
+ def item_class
24
+ return item_enforcement if item_enforcement.is_a?(Class)
25
+
26
+ item_class = superclass.__send__(:item_enforcement) if superclass.respond_to?(:item_enforcement, true)
27
+ return item_class if item_class.present?
28
+
29
+ # Prevents against the case of `Material::List` becoming `Material` and returning a module
30
+ item_class = name.chomp("List").safe_constantize
31
+ item_class if item_class.is_a?(Class)
32
+ end
33
+
34
+ def ensure_item_validity_with
35
+ super || item_class
36
+ end
20
37
  end
21
38
 
22
39
  def default_title
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Material
4
- VERSION = "0.2.10"
4
+ VERSION = "0.2.11"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: material
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Garside