Class: GraphQL::Relay::RangeAdd
- Inherits:
-
Object
- Object
- GraphQL::Relay::RangeAdd
- Defined in:
- lib/graphql/relay/range_add.rb
Overview
This provides some isolation from GraphQL::Relay
internals.
Given a list of items and a new item, it will provide a connection and an edge.
The connection doesn’t receive outside arguments, so the list of items should be ordered and paginated before providing it here.
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#edge ⇒ Object
readonly
Returns the value of attribute edge.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(collection:, item:, parent: nil, context: nil, edge_class: Relay::Edge) ⇒ RangeAdd
constructor
A new instance of RangeAdd.
Constructor Details
#initialize(collection:, item:, parent: nil, context: nil, edge_class: Relay::Edge) ⇒ RangeAdd
Returns a new instance of RangeAdd
37 38 39 40 41 42 |
# File 'lib/graphql/relay/range_add.rb', line 37 def initialize(collection:, item:, parent: nil, context: nil, edge_class: Relay::Edge) connection_class = BaseConnection.connection_for_nodes(collection) @parent = parent @connection = connection_class.new(collection, {}, parent: parent, context: context) @edge = edge_class.new(item, @connection) end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection
30 31 32 |
# File 'lib/graphql/relay/range_add.rb', line 30 def connection @connection end |
#edge ⇒ Object (readonly)
Returns the value of attribute edge
30 31 32 |
# File 'lib/graphql/relay/range_add.rb', line 30 def edge @edge end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent
30 31 32 |
# File 'lib/graphql/relay/range_add.rb', line 30 def parent @parent end |