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 +4 -4
- data/lib/material/list.rb +20 -3
- data/lib/material/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed245f0f0fe5e5166138014bd4a4b9d25be10f8d6962b07933ddb8759fda864f
|
4
|
+
data.tar.gz: 92c654d62c960e15fdc7d500ab8d9c1fc9424593fea193cee138ef77349bbd11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
18
|
-
|
19
|
-
|
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
|
data/lib/material/version.rb
CHANGED