Sha256: cf2d8987e6824418ba67d6c05e651a46ae1cae072c61043b1dc0583eb761fa5e

Contents?: true

Size: 413 Bytes

Versions: 8

Compression:

Stored size: 413 Bytes

Contents

# frozen_string_literal: true
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

8 entries across 8 versions & 1 rubygems

Version Path
graphql-1.5.3 lib/graphql/introspection/typename_field.rb
graphql-1.4.5 lib/graphql/introspection/typename_field.rb
graphql-1.4.4 lib/graphql/introspection/typename_field.rb
graphql-1.4.3 lib/graphql/introspection/typename_field.rb
graphql-1.4.2 lib/graphql/introspection/typename_field.rb
graphql-1.4.1 lib/graphql/introspection/typename_field.rb
graphql-1.4.0 lib/graphql/introspection/typename_field.rb
graphql-1.3.0 lib/graphql/introspection/typename_field.rb