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:
116 117 118 |
# File 'lib/kaminari/helpers/tags.rb', line 116 def initialize(, page, last) #:nodoc: @options, @page, @last = , page, last end |
Instance Method Details
#current? ⇒ Boolean
current page or not
126 127 128 |
# File 'lib/kaminari/helpers/tags.rb', line 126 def current? @page == @options[:current_page] end |
#first? ⇒ Boolean
the first page or not
131 132 133 |
# File 'lib/kaminari/helpers/tags.rb', line 131 def first? @page == 1 end |
#inside_window? ⇒ Boolean
inside the inner window or not
151 152 153 |
# File 'lib/kaminari/helpers/tags.rb', line 151 def inside_window? (@page - @options[:current_page]).abs <= @options[:window] end |
#last? ⇒ Boolean
the last page or not
136 137 138 |
# File 'lib/kaminari/helpers/tags.rb', line 136 def last? @page == @options[:num_pages] end |
#left_outer? ⇒ Boolean
within the left outer window or not
141 142 143 |
# File 'lib/kaminari/helpers/tags.rb', line 141 def left_outer? @page <= @options[:left] + 1 end |
#number ⇒ Object
the page number
121 122 123 |
# File 'lib/kaminari/helpers/tags.rb', line 121 def number @page end |
#right_outer? ⇒ Boolean
within the right outer window or not
146 147 148 |
# File 'lib/kaminari/helpers/tags.rb', line 146 def right_outer? @options[:num_pages] - @page <= @options[:right] end |
#was_truncated? ⇒ Boolean
The last rendered tag was “truncated” or not
156 157 158 |
# File 'lib/kaminari/helpers/tags.rb', line 156 def was_truncated? @last.is_a? TruncatedSpan end |