module Gummi module Repository class Result attr_reader :took, :total, :hits, :facets def initialize(db_result, repository, per_page, page) @took = db_result.took @total = db_result.total @hits = db_result.hits @facets = db_result.facets @db_records = db_result.records @repository = repository @per_page = per_page @page = page end def records entities = Array(@repository.to_entity_from_db(@db_records)) if @db_records Leaflet::Collection.new entities, {per_page: @per_page, current_page: @page, total_entries: total} end end end end