Module: SearchObject::Plugin::Paging

Included in:
Kaminari, WillPaginate
Defined in:
lib/search_object/plugin/paging.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pageObject (readonly)

Returns the value of attribute page.



8
9
10
# File 'lib/search_object/plugin/paging.rb', line 8

def page
  @page
end

#per_pageObject (readonly)

Returns the value of attribute per_page.



8
9
10
# File 'lib/search_object/plugin/paging.rb', line 8

def per_page
  @per_page
end

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/search_object/plugin/paging.rb', line 4

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#initialize(options = {}) ⇒ Object



10
11
12
13
14
15
# File 'lib/search_object/plugin/paging.rb', line 10

def initialize(options = {})
  @page     = [options[:page].to_i, 0].max
  @per_page = self.class.calculate_per_page options[:per_page]

  super options
end