Sha256: 90778f553c93cded839ab40a71e410aedbb87b3f94e220951c10cf63b2baf96f

Contents?: true

Size: 470 Bytes

Versions: 4

Compression:

Stored size: 470 Bytes

Contents

# frozen_string_literal: true

require_relative './record_size_for_helper'
require_relative './page_size_for_helper'

module Pagination
  module TotalPagesForHelper
    include Pagination::RecordSizeForHelper
    include Pagination::PageSizeForHelper

    def pagination_total_pages_for(set)
      total_set_size = pagination_record_size_for(set)
      return 1 if total_set_size.zero?

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
actionset-0.11.0 lib/action_set/helpers/pagination/total_pages_for_helper.rb
actionset-0.10.0 lib/action_set/helpers/pagination/total_pages_for_helper.rb
actionset-0.9.2 lib/action_set/helpers/pagination/total_pages_for_helper.rb
actionset-0.9.1 lib/action_set/helpers/pagination/total_pages_for_helper.rb