Class: GraphQL::Relay::RelationConnection
- Inherits:
-
BaseConnection
- Object
- BaseConnection
- GraphQL::Relay::RelationConnection
- Defined in:
- lib/graphql/relay/relation_connection.rb
Constant Summary
Constants inherited from BaseConnection
BaseConnection::CONNECTION_IMPLEMENTATIONS, BaseConnection::CURSOR_SEPARATOR, BaseConnection::METHODS_FROM_ARGUMENTS
Instance Attribute Summary
Attributes inherited from BaseConnection
#arguments, #max_page_size, #object
Instance Method Summary collapse
- #cursor_from_node(item) ⇒ Object
- #has_next_page ⇒ Object
-
#has_previous_page ⇒ Object
Used by ‘pageInfo`.
Methods inherited from BaseConnection
#after, #before, connection_for_items, create_type, #edges, #first, #initialize, #last, #order, #page_info, register_connection_implementation
Constructor Details
This class inherits a constructor from GraphQL::Relay::BaseConnection
Instance Method Details
#cursor_from_node(item) ⇒ Object
4 5 6 7 |
# File 'lib/graphql/relay/relation_connection.rb', line 4 def cursor_from_node(item) offset = starting_offset + paged_nodes_array.index(item) + 1 Base64.strict_encode64(offset.to_s) end |
#has_next_page ⇒ Object
9 10 11 |
# File 'lib/graphql/relay/relation_connection.rb', line 9 def has_next_page !!(first && sliced_nodes.limit(first + 1).count > first) end |
#has_previous_page ⇒ Object
Used by ‘pageInfo`
14 15 16 |
# File 'lib/graphql/relay/relation_connection.rb', line 14 def has_previous_page !!(last && sliced_nodes.limit(last + 1).count > last) end |