module Facet::Collection

Public Instance Methods

collection() click to toggle source
# File lib/facet/concerns/collection.rb, line 17
def collection
  (source? ? source.public_send(self_scope) : record_class).public_send(record_scope)
end
output() click to toggle source
# 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
Also aliased as: to_ary
to_a()
Alias for: to_ary
to_ary()

Template rendering checks for this method to exist and calls it to get the actual data to render

Also aliased as: to_a
Alias for: output

Private Instance Methods

filtered_collection() click to toggle source
# File lib/facet/concerns/collection.rb, line 39
def filtered_collection
  return collection unless filtered?

  collection.public_send(filter_by)
end
sorted_filtered_collection() click to toggle source
# File lib/facet/concerns/collection.rb, line 33
def sorted_filtered_collection
  return filtered_collection unless sorted?

  filtered_collection.public_send(sort_by)
end