Class: RESTFramework::Paginators::BasePaginator

Inherits:
Object
  • Object
show all
Defined in:
lib/rest_framework/paginators/base_paginator.rb

Direct Known Subclasses

PageNumberPaginator

Instance Method Summary collapse

Constructor Details

#initialize(data:, controller:, **kwargs) ⇒ BasePaginator

Returns a new instance of BasePaginator.



2
3
4
5
# File 'lib/rest_framework/paginators/base_paginator.rb', line 2

def initialize(data:, controller:, **kwargs)
  @data = data
  @controller = controller
end

Instance Method Details

#get_pageObject

Get the page and return it so the caller can serialize it.

Raises:

  • (NotImplementedError)


8
9
10
# File 'lib/rest_framework/paginators/base_paginator.rb', line 8

def get_page
  raise NotImplementedError
end

#get_paginated_response(serialized_page) ⇒ Object

Wrap the serialized page with appropriate metadata.

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/rest_framework/paginators/base_paginator.rb', line 13

def get_paginated_response(serialized_page)
  raise NotImplementedError
end