Module: Transit::Model::Paginator::Scoping

Defined in:
lib/transit/model/paginator.rb

Instance Method Summary collapse

Instance Method Details

#current_pageObject

Current page number



78
79
80
# File 'lib/transit/model/paginator.rb', line 78

def current_page
  (options[:skip] / options[:limit]) + 1
end

#first_page?Boolean

First page of the collection ?

Returns:

  • (Boolean)


82
83
84
# File 'lib/transit/model/paginator.rb', line 82

def first_page?
  current_page == 1
end

#last_page?Boolean

Last page of the collection?

Returns:

  • (Boolean)


86
87
88
# File 'lib/transit/model/paginator.rb', line 86

def last_page?
  current_page >= num_pages
end

#total_countObject

:nodoc:



70
71
72
# File 'lib/transit/model/paginator.rb', line 70

def total_count #:nodoc:
  count
end

#total_pagesObject

Total number of pages



74
75
76
# File 'lib/transit/model/paginator.rb', line 74

def total_pages
  (total_count.to_f / options[:limit]).ceil
end