Sha256: 5892eb2dbfd1960218e1c4464e616b8f76deb24906dd13dca1b2798ef5d5a5e9

Contents?: true

Size: 363 Bytes

Versions: 3

Compression:

Stored size: 363 Bytes

Contents

# frozen_string_literal: true

require_relative './page_size_for_helper'

module Pagination
  module TotalPagesForHelper
    include Pagination::PageSizeForHelper

    def pagination_total_pages_for(set)
      total_set_size = set.set.count
      return 1 if total_set_size == 0

      (total_set_size.to_f / pagination_page_size_for(set)).ceil
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
actionset-0.5.4 lib/action_set/helpers/pagination/total_pages_for_helper.rb
actionset-0.5.3 lib/action_set/helpers/pagination/total_pages_for_helper.rb
actionset-0.5.2 lib/action_set/helpers/pagination/total_pages_for_helper.rb