Parent

Included Modules

Class Index [+]

Quicksearch

Ramaze::Helper::Paginate::Paginator::ArrayPager

Wrapper for Array to behave like the Sequel pagination

Public Class Methods

new(array, page, limit) click to toggle source
     # File lib/ramaze/helper/paginate.rb, line 236
236:           def initialize(array, page, limit)
237:             @array, @page, @limit = array, page, limit
238:             @page = page_count if @page > page_count
239:           end

Public Instance Methods

current_page() click to toggle source
     # File lib/ramaze/helper/paginate.rb, line 254
254:           def current_page
255:             @page
256:           end
each(&block) click to toggle source
     # File lib/ramaze/helper/paginate.rb, line 274
274:           def each(&block)
275:             from = ((@page - 1) * @limit)
276:             to = from + @limit
277: 
278:             a = @array[from...to] || []
279:             a.each(&block)
280:           end
empty?() click to toggle source
     # File lib/ramaze/helper/paginate.rb, line 245
245:           def empty?
246:             @array.empty?
247:           end
first_page?() click to toggle source
     # File lib/ramaze/helper/paginate.rb, line 266
266:           def first_page?
267:             @page <= 1
268:           end
last_page?() click to toggle source
     # File lib/ramaze/helper/paginate.rb, line 270
270:           def last_page?
271:             page_count == @page
272:           end
next_page() click to toggle source
     # File lib/ramaze/helper/paginate.rb, line 258
258:           def next_page
259:             page_count == @page ? nil : @page + 1
260:           end
page_count() click to toggle source
     # File lib/ramaze/helper/paginate.rb, line 249
249:           def page_count
250:             pages, rest = size.divmod(@limit)
251:             rest == 0 ? pages : pages + 1
252:           end
prev_page() click to toggle source
     # File lib/ramaze/helper/paginate.rb, line 262
262:           def prev_page
263:             @page <= 1 ? nil : @page - 1
264:           end
size() click to toggle source
     # File lib/ramaze/helper/paginate.rb, line 241
241:           def size
242:             @array.size
243:           end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.