Class: OpenAPIRest::Operations::Paginate
- Inherits:
-
Object
- Object
- OpenAPIRest::Operations::Paginate
- Defined in:
- lib/openapi_rest/operations/paginate.rb
Overview
Rest paginate operation
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(query_builder) ⇒ Paginate
constructor
A new instance of Paginate.
Constructor Details
#initialize(query_builder) ⇒ Paginate
Returns a new instance of Paginate.
7 8 9 |
# File 'lib/openapi_rest/operations/paginate.rb', line 7 def initialize(query_builder) @query_builder = query_builder end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 |
# File 'lib/openapi_rest/operations/paginate.rb', line 11 def execute return if @query_builder.single? @query_builder.api_model.model = @query_builder.api_model.model.limit(@query_builder.limit) .offset(@query_builder.offset) end |