Class: RailsCursorPagination::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/rails_cursor_pagination/configuration.rb

Overview

Configuration class to set the default gem settings. Accessible via ‘RailsCursorPagination.configure`.

Usage:

RailsCursorPagination.configure do |config|
  config.default_page_size = 42
  config.max_page_size = 100
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Ensure the default values are set on first initialization



22
23
24
# File 'lib/rails_cursor_pagination/configuration.rb', line 22

def initialize
  reset!
end

Instance Attribute Details

#default_page_sizeObject

Returns the value of attribute default_page_size.



19
20
21
# File 'lib/rails_cursor_pagination/configuration.rb', line 19

def default_page_size
  @default_page_size
end

#max_page_sizeObject

Returns the value of attribute max_page_size.



19
20
21
# File 'lib/rails_cursor_pagination/configuration.rb', line 19

def max_page_size
  @max_page_size
end

Instance Method Details

#reset!Object

Reset all values to their defaults



27
28
29
30
# File 'lib/rails_cursor_pagination/configuration.rb', line 27

def reset!
  @default_page_size = 10
  @max_page_size = nil
end