Permalink
Browse files

Better Pager.calculate_pages implementation.

  • Loading branch information...
1 parent 82bd83f commit 0ce425443f619cf275f9709d22cff7fd0e8a3a3d @mojombo mojombo committed May 9, 2011
Showing with 1 addition and 3 deletions.
  1. +1 −3 lib/jekyll/generators/pagination.rb
@@ -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.

0 comments on commit 0ce4254

Please sign in to comment.