Class: Kaminari::Helpers::Paginator::PageProxy
- Inherits:
-
Object
- Object
- Kaminari::Helpers::Paginator::PageProxy
- Defined in:
- lib/kaminari/helpers/tags.rb
Overview
Wraps a “page number” and provides some utility methods
Instance Method Summary collapse
-
#current? ⇒ Boolean
current page or not.
-
#first? ⇒ Boolean
the first page or not.
-
#initialize(options, page, last) ⇒ PageProxy
constructor
:nodoc:.
-
#inside_window? ⇒ Boolean
inside the inner window or not.
-
#last? ⇒ Boolean
the last page or not.
-
#left_outer? ⇒ Boolean
within the left outer window or not.
-
#number ⇒ Object
the page number.
-
#right_outer? ⇒ Boolean
within the right outer window or not.
-
#was_truncated? ⇒ Boolean
The last rendered tag was “truncated” or not.
Constructor Details
#initialize(options, page, last) ⇒ PageProxy
:nodoc:
119 120 121 |
# File 'lib/kaminari/helpers/tags.rb', line 119 def initialize(, page, last) #:nodoc: @options, @page, @last = , page, last end |
Instance Method Details
#current? ⇒ Boolean
current page or not
129 130 131 |
# File 'lib/kaminari/helpers/tags.rb', line 129 def current? @page == @options[:current_page] end |
#first? ⇒ Boolean
the first page or not
134 135 136 |
# File 'lib/kaminari/helpers/tags.rb', line 134 def first? @page == 1 end |
#inside_window? ⇒ Boolean
inside the inner window or not
154 155 156 |
# File 'lib/kaminari/helpers/tags.rb', line 154 def inside_window? (@page - @options[:current_page]).abs <= @options[:window] end |
#last? ⇒ Boolean
the last page or not
139 140 141 |
# File 'lib/kaminari/helpers/tags.rb', line 139 def last? @page == @options[:num_pages] end |
#left_outer? ⇒ Boolean
within the left outer window or not
144 145 146 |
# File 'lib/kaminari/helpers/tags.rb', line 144 def left_outer? @page <= @options[:left] + 1 end |
#number ⇒ Object
the page number
124 125 126 |
# File 'lib/kaminari/helpers/tags.rb', line 124 def number @page end |
#right_outer? ⇒ Boolean
within the right outer window or not
149 150 151 |
# File 'lib/kaminari/helpers/tags.rb', line 149 def right_outer? @options[:num_pages] - @page <= @options[:right] end |
#was_truncated? ⇒ Boolean
The last rendered tag was “truncated” or not
159 160 161 |
# File 'lib/kaminari/helpers/tags.rb', line 159 def was_truncated? @last.is_a? TruncatedSpan end |