Class: Gitlab::Pagination::OffsetPagination

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/pagination/offset_pagination.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#finalize

Constructor Details

#initialize(request_context) ⇒ OffsetPagination

Returns a new instance of OffsetPagination.


9
10
11
# File 'lib/gitlab/pagination/offset_pagination.rb', line 9

def initialize(request_context)
  @request_context = request_context
end

Instance Attribute Details

#request_contextObject (readonly)

Returns the value of attribute request_context


6
7
8
# File 'lib/gitlab/pagination/offset_pagination.rb', line 6

def request_context
  @request_context
end

Instance Method Details

#paginate(relation) ⇒ Object


13
14
15
16
17
# File 'lib/gitlab/pagination/offset_pagination.rb', line 13

def paginate(relation)
  paginate_with_limit_optimization(add_default_order(relation)).tap do |data|
    add_pagination_headers(data)
  end
end