Class: Gitlab::Pagination::OffsetPagination
- Defined in:
- lib/gitlab/pagination/offset_pagination.rb
Instance Attribute Summary collapse
-
#request_context ⇒ Object
readonly
Returns the value of attribute request_context.
Instance Method Summary collapse
-
#initialize(request_context) ⇒ OffsetPagination
constructor
A new instance of OffsetPagination.
- #paginate(relation, exclude_total_headers: false, skip_default_order: false, without_count: false) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(request_context) ⇒ OffsetPagination
Returns a new instance of OffsetPagination.
10 11 12 |
# File 'lib/gitlab/pagination/offset_pagination.rb', line 10 def initialize(request_context) @request_context = request_context end |
Instance Attribute Details
#request_context ⇒ Object (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, exclude_total_headers: false, skip_default_order: false, without_count: false) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/gitlab/pagination/offset_pagination.rb', line 14 def paginate(relation, exclude_total_headers: false, skip_default_order: false, without_count: false) ordered_relation = add_default_order(relation, skip_default_order: skip_default_order) paginate_with_limit_optimization(ordered_relation, without_count: without_count).tap do |data| add_pagination_headers(data, exclude_total_headers) end end |