Class: Material::List
Constant Summary
Constants included
from Text
Text::DEFAULT_TRUNCATE_LENGTH
Constants included
from Components
Components::CLASSES_TO_DUPLICATE
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Collection
#to_ary
Methods included from Mount
#mount_facet
Methods included from Pagination
#initialize
Class Method Details
.for(object) ⇒ Object
19
20
21
22
|
# File 'lib/material/list.rb', line 19
def for(object)
klass = for_class((object.respond_to?(:to_ary) && object.respond_to?(:first)) ? object.first : object)
materialize(object, klass) if klass.present?
end
|
.for_class(object) ⇒ Object
24
25
26
|
# File 'lib/material/list.rb', line 24
def for_class(object)
object.try(:conjugate!, self)
end
|
Instance Method Details
#contextualize(parent) ⇒ Object
42
43
44
|
# File 'lib/material/list.rb', line 42
def contextualize(parent)
@context_parent = parent
end
|
#default_parent ⇒ Object
46
47
48
|
# File 'lib/material/list.rb', line 46
def default_parent
@context_parent
end
|
#default_title ⇒ Object
50
51
52
|
# File 'lib/material/list.rb', line 50
def default_title
(item_class.try(:model_name)&.human || item_class&.name).pluralize || self.class.name
end
|