Class: Pagoid::WillPaginate

Inherits:
PagingAdapter show all
Defined in:
lib/pagoid/will_paginate.rb

Instance Attribute Summary

Attributes inherited from PagingAdapter

#attributes, #paginatable

Instance Method Summary collapse

Methods inherited from PagingAdapter

#chain, #coerce, #initialize

Constructor Details

This class inherits a constructor from Pagoid::PagingAdapter

Instance Method Details

#first_page?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/pagoid/will_paginate.rb', line 32

def first_page?
  current_page == 1
end

#last_page?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/pagoid/will_paginate.rb', line 36

def last_page?
  current_page == total_pages
end

#limit_valueObject



8
9
10
# File 'lib/pagoid/will_paginate.rb', line 8

def limit_value
  per_page
end

#offset_valueObject



12
13
14
# File 'lib/pagoid/will_paginate.rb', line 12

def offset_value
  offset
end

#page(num) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/pagoid/will_paginate.rb', line 16

def page(num)
  if array?
    chain __getobj__.paginate(page: num), original: __getobj__, page: num
  else
    chain super
  end
end

#per(num) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/pagoid/will_paginate.rb', line 24

def per(num)
  if array?
    chain per_object.paginate(page: attributes[:page], per_page: num)
  else
    chain __getobj__.per_page(num)
  end
end

#total_countObject



4
5
6
# File 'lib/pagoid/will_paginate.rb', line 4

def total_count
  count
end