Class: ElasticGraph::GraphQL::DatastoreQuery::Paginator::SortValue
- Inherits:
-
Data
- Object
- Data
- ElasticGraph::GraphQL::DatastoreQuery::Paginator::SortValue
- Defined in:
- lib/elastic_graph/graphql/datastore_query/paginator.rb
Instance Method Summary collapse
Instance Method Details
#item_satisfies_compared_to_cursor?(comparison_operator) ⇒ Boolean
181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/elastic_graph/graphql/datastore_query/paginator.rb', line 181 def item_satisfies_compared_to_cursor?(comparison_operator) if from_item.nil? # nil values sort first when sorting ascending, and last when sorting descending. # (see `DocumentPaginator#sort` for a more thorough explanation). sort_direction == :asc elsif from_cursor.nil? # nil values sort first when sorting ascending, and last when sorting descending. # (see `DocumentPaginator#sort` for a more thorough explanation). sort_direction == :desc else # both `from_item` and `from_cursor` are non-nil, and can be compared. result = from_item.public_send(comparison_operator, from_cursor) (sort_direction == :asc) ? result : !result end end |
#unequal? ⇒ Boolean
177 178 179 |
# File 'lib/elastic_graph/graphql/datastore_query/paginator.rb', line 177 def unequal? from_item != from_cursor end |