= pagination_render_logic I needed a gem that will provide only the logic for displaying different styles of pagination so i have built this gem to do exactly that. So far i have created only the digg style pagination but i plan to add Google, simple with Previous and Next page only and other... Here is how the digg pagination looks like # First Previous 1 2 3 ... 22 23 24 25 26 [27] 28 29 30 31 32 ... 48 49 50 Next Last The logic is simple: The chunk 1 2 3 ... i call first_page_section The chunk ... 48 49 50 i call last_page_section The chunk 22 23 24 25 26 [27] 28 29 30 31 32 is middle_section The responsibility of the gem is also simple, it should provide the answers of the following questions in order to render this type of pagination easy. Note that when i say links i refer to the page numbers. 1. Do we have links at all? 2. Do we need to render the first_page_section and if true give me the links (note that the dots are not included in the links we add them manually) 3. Do we have a last_page_section and if true give me the links 4. Give me the middle_section since it is always present if we have links. 5. And the first_page if has_first_page, next_page if has_next_page, previous_page etc. Usage Example: Here is how i use this gem in my sinatra blog paginate helper. first i require this gem in my config.ru require 'paginate-simple' require 'pagination_render_logic/digg' Note that pagination_render_logic does not depend on paginate-simple i simply use it for convenience. In order to use my renderer i have created a class in my lib dir which is autoloaded by default. class PaginationRenderer extend PaginationRenderLogic::Digg end And here is the sinatra paginatinon helper require 'sinatra/base' module Sinatra module PaginationHelper def paginate(resource) data = [] PaginationRenderer.config! :total_pages => Paginator.num_of_pages, :current_page => Paginator.current_page, :after_first_page => 3, :arround_current_page => 5 if PaginationRenderer.has_links? data << '