class PaginatedCollection::Base

Attributes

pagination[RW]

Public Class Methods

build_with(elems, pagination: {}, &block) click to toggle source
# File lib/paginated_collection/base.rb, line 16
def self.build_with(elems, pagination: {}, &block)
  members = elems.map { |e| block.call(e) }
  new(*members, pagination: pagination)
end
new(*members, pagination: {}) click to toggle source
Calls superclass method
# File lib/paginated_collection/base.rb, line 6
def initialize *members, pagination: {}
  p = pagination.symbolize_keys
  @pagination = Pagination.new(p[:current_page],
                               p[:total_pages],
                               p[:per_page],
                               p[:total])

  super members
end