mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
Reduce Ruby ⚠️s
This commit is contained in:
parent
853ab980a0
commit
d23564457c
2 changed files with 5 additions and 5 deletions
|
@ -13,7 +13,7 @@ module Kaminari
|
|||
# This model's default +per_page+ value
|
||||
# returns +default_per_page+ value unless explicitly overridden via <tt>paginates_per</tt>
|
||||
def default_per_page
|
||||
@_default_per_page || Kaminari.config.default_per_page
|
||||
(defined?(@_default_per_page) && @_default_per_page) || Kaminari.config.default_per_page
|
||||
end
|
||||
|
||||
# Overrides the max +per_page+ value per model
|
||||
|
@ -27,7 +27,7 @@ module Kaminari
|
|||
# This model's max +per_page+ value
|
||||
# returns +max_per_page+ value unless explicitly overridden via <tt>max_paginates_per</tt>
|
||||
def max_per_page
|
||||
@_max_per_page || Kaminari.config.max_per_page
|
||||
(defined?(@_max_per_page) && @_max_per_page) || Kaminari.config.max_per_page
|
||||
end
|
||||
|
||||
# Overrides the max_pages value per model
|
||||
|
@ -41,7 +41,7 @@ module Kaminari
|
|||
# This model's max_pages value
|
||||
# returns max_pages value unless explicitly overridden via <tt>max_pages_per</tt>
|
||||
def max_pages
|
||||
@_max_pages || Kaminari.config.max_pages
|
||||
(defined?(@_max_pages) && @_max_pages) || Kaminari.config.max_pages
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ module Kaminari
|
|||
return 1 if limit_value.nil?
|
||||
|
||||
count_without_padding = total_count
|
||||
count_without_padding -= @_padding if @_padding
|
||||
count_without_padding -= @_padding if defined?(@_padding) && @_padding
|
||||
count_without_padding = 0 if count_without_padding < 0
|
||||
|
||||
total_pages_count = (count_without_padding.to_f / limit_value).ceil
|
||||
|
@ -42,7 +42,7 @@ module Kaminari
|
|||
return 1 if limit_value.nil?
|
||||
|
||||
offset_without_padding = offset_value
|
||||
offset_without_padding -= @_padding if @_padding
|
||||
offset_without_padding -= @_padding if defined?(@_padding) && @_padding
|
||||
offset_without_padding = 0 if offset_without_padding < 0
|
||||
|
||||
(offset_without_padding / limit_value) + 1
|
||||
|
|
Loading…
Reference in a new issue