Skip to content

Commit

Permalink
Better Pager.calculate_pages implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed May 9, 2011
1 parent 82bd83f commit 0ce4254
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/jekyll/generators/pagination.rb
Expand Up @@ -56,9 +56,7 @@ class Pager
#
# Returns the Integer number of pages.
def self.calculate_pages(all_posts, per_page)
num_pages = all_posts.size / per_page.to_i
num_pages = num_pages + 1 if all_posts.size % per_page.to_i != 0
num_pages
(all_posts.size.to_f / per_page.to_i).ceil
end

# Determine if pagination is enabled for a given file.
Expand Down

0 comments on commit 0ce4254

Please sign in to comment.