Sha256: 87f60ab8d9c7dfe9729ddda82dd10f409473495a38c66e54063ac06133df7dec

Contents?: true

Size: 383 Bytes

Versions: 10

Compression:

Stored size: 383 Bytes

Contents

module GraphQL
  module Introspection
    # A wrapper to create `__typename`.
    class TypenameField
      def self.create(wrapped_type)
        GraphQL::Field.define do
          name "__typename"
          description "The name of this type"
          type -> { !GraphQL::STRING_TYPE }
          resolve ->(obj, a, c) { wrapped_type.name }
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
graphql-1.2.6 lib/graphql/introspection/typename_field.rb
graphql-1.2.5 lib/graphql/introspection/typename_field.rb
graphql-1.2.4 lib/graphql/introspection/typename_field.rb
graphql-1.2.3 lib/graphql/introspection/typename_field.rb
graphql-1.2.2 lib/graphql/introspection/typename_field.rb
graphql-1.2.1 lib/graphql/introspection/typename_field.rb
graphql-1.2.0 lib/graphql/introspection/typename_field.rb
graphql-1.1.0 lib/graphql/introspection/typename_field.rb
graphql-1.0.0 lib/graphql/introspection/typename_field.rb
graphql-0.19.4 lib/graphql/introspection/typename_field.rb