Method: GraphQL::Pagination::Connections#wrap
- Defined in:
- lib/graphql/pagination/connections.rb
#wrap(field, parent, items, arguments, context) ⇒ Object
Used by the runtime to wrap values in connection wrappers.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/graphql/pagination/connections.rb', line 61 def wrap(field, parent, items, arguments, context) return items if GraphQL::Execution::Interpreter::RawValue === items wrappers = context ? context.namespace(:connections)[:all_wrappers] : all_wrappers impl = wrapper_for(items, wrappers: wrappers) if impl impl.new( items, context: context, parent: parent, field: field, max_page_size: field.has_max_page_size? ? field.max_page_size : context.schema.default_max_page_size, default_page_size: field.has_default_page_size? ? field.default_page_size : context.schema.default_page_size, first: arguments[:first], after: arguments[:after], last: arguments[:last], before: arguments[:before], arguments: arguments, edge_class: edge_class_for_field(field), ) else raise ImplementationMissingError, "Couldn't find a connection wrapper for #{items.class} during #{field.path} (#{items.inspect})" end end |