Class: GraphQL::FancyLoader::PaginationFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/fancy_loader/pagination_filter.rb

Instance Method Summary collapse

Constructor Details

#initialize(query, before: nil, after: nil, first: nil, last: nil) ⇒ PaginationFilter

Returns a new instance of PaginationFilter.



4
5
6
7
8
9
10
# File 'lib/graphql/fancy_loader/pagination_filter.rb', line 4

def initialize(query, before: nil, after: nil, first: nil, last: nil)
  @query = query
  @before = before
  @after = after
  @first = first
  @last = last
end

Instance Method Details

#arelObject



12
13
14
15
16
17
18
19
# File 'lib/graphql/fancy_loader/pagination_filter.rb', line 12

def arel
  [
    after_filter,
    before_filter,
    first_filter,
    last_filter
  ].compact.inject(&:and)
end