Class: Pagoid::WillPaginate
Instance Attribute Summary
#attributes, #paginatable
Instance Method Summary
collapse
#chain, #coerce, #initialize
Instance Method Details
#first_page? ⇒ Boolean
32
33
34
|
# File 'lib/pagoid/will_paginate.rb', line 32
def first_page?
current_page == 1
end
|
#last_page? ⇒ Boolean
36
37
38
|
# File 'lib/pagoid/will_paginate.rb', line 36
def last_page?
current_page == total_pages
end
|
#limit_value ⇒ Object
8
9
10
|
# File 'lib/pagoid/will_paginate.rb', line 8
def limit_value
per_page
end
|
#offset_value ⇒ Object
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_count ⇒ Object
4
5
6
|
# File 'lib/pagoid/will_paginate.rb', line 4
def total_count
count
end
|