Module: Facet::Collection
Instance Method Summary collapse
- #collection ⇒ Object
- #filtered_collection ⇒ Object private
- #output ⇒ Object (also: #to_ary)
- #sorted_filtered_collection ⇒ Object private
Instance Method Details
#collection ⇒ Object
17 18 19 |
# File 'lib/facet/concerns/collection.rb', line 17 def collection (source? ? source.public_send(self_scope) : record_class).public_send(record_scope) end |
#filtered_collection ⇒ Object (private)
39 40 41 42 43 |
# File 'lib/facet/concerns/collection.rb', line 39 def filtered_collection return collection unless filtered? collection.public_send(filter_by) end |
#output ⇒ Object Also known as: to_ary
21 22 23 24 25 |
# File 'lib/facet/concerns/collection.rb', line 21 def output return sorted_filtered_collection unless current_page.present? && current_page >= 0 sorted_filtered_collection.paginate(page: current_page) end |
#sorted_filtered_collection ⇒ Object (private)
33 34 35 36 37 |
# File 'lib/facet/concerns/collection.rb', line 33 def sorted_filtered_collection return filtered_collection unless sorted? filtered_collection.public_send(sort_by) end |