Class: CursorPager::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/cursor_pager/configuration.rb

Overview

Encapulates all the configuration for the library.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



22
23
24
25
26
# File 'lib/cursor_pager/configuration.rb', line 22

def initialize
  @encoder = Base64Encoder
  @default_page_size = nil
  @maximum_page_size = nil
end

Instance Attribute Details

#default_page_sizeObject

The default page size that will be used if no ‘first` or `last` were specified. Every record fitting the cursor constraints will be returned if it’s set to ‘nil`. Defaults to `nil`.



15
16
17
# File 'lib/cursor_pager/configuration.rb', line 15

def default_page_size
  @default_page_size
end

#encoderObject

The encoder that will be used to encode & decode cursors. Defaults to ‘Base64Encoder`.



9
10
11
# File 'lib/cursor_pager/configuration.rb', line 9

def encoder
  @encoder
end

#maximum_page_sizeObject

The maximum allowed page size. Clients will never receive more records per page than is sepcified here. There is no maximum if this is set to ‘nil`. Defaults to `nil`.



20
21
22
# File 'lib/cursor_pager/configuration.rb', line 20

def maximum_page_size
  @maximum_page_size
end