Method: GraphQL::Relay::RangeAdd#initialize
- Defined in:
- lib/graphql/relay/range_add.rb
permalink #initialize(collection:, item:, context:, parent: nil, edge_class: nil) ⇒ RangeAdd
Returns a new instance of RangeAdd.
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/graphql/relay/range_add.rb', line 37 def initialize(collection:, item:, context:, parent: nil, edge_class: nil) conn_class = context.schema.connections.wrapper_for(collection) # The rest will be added by ConnectionExtension @connection = conn_class.new(collection, parent: parent, context: context, edge_class: edge_class) # Check if this connection supports it, to support old versions of GraphQL-Pro @edge = if @connection.respond_to?(:range_add_edge) @connection.range_add_edge(item) else @connection.edge_class.new(item, @connection) end @parent = parent end |