Sha256: a6b2c9a2b70ce03544fb476d6e70d9152dc4ac080b1585595817ad66c2efaa8c

Contents?: true

Size: 585 Bytes

Versions: 3

Compression:

Stored size: 585 Bytes

Contents

module GraphqlPagination
  module CollectionType
    def collection_type(metadata_type: GraphqlPagination::CollectionMetadataType)
      @collection_type ||= begin
        type_name = "#{graphql_name}Collection"
        source_type = self

        Class.new(GraphQL::Schema::Object) do
          graphql_name type_name
          field :collection, [source_type], null: false
          field :metadata, metadata_type, null: false

          def collection
            object
          end

          def metadata
            object
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
graphql-pagination-1.1.2 lib/graphql_pagination/collection_type.rb
graphql-pagination-1.1.1 lib/graphql_pagination/collection_type.rb
graphql-pagination-1.1.0 lib/graphql_pagination/collection_type.rb