lib/page_up/pages.rb in page_up-0.0.2 vs lib/page_up/pages.rb in page_up-0.0.3

- old
+ new

@@ -7,11 +7,15 @@ @origin = collection super collection[page_range] end def pages - (@origin.size.to_f / per_page).ceil + if @origin.size > 0 + (@origin.size.to_f / per_page).ceil + else + 1 + end end def current_slice slice_start..slice_end end @@ -42,10 +46,10 @@ page - 2 end end def slice_end - if page + 2 > pages + if page + 2 > pages || pages < 5 pages elsif page - 2 <= 0 5 else page + 2