Sha256: 2f01d7fb5ef15543471effc04e191391f0498765854c9eecb1e79673d876195c

Contents?: true

Size: 466 Bytes

Versions: 2

Compression:

Stored size: 466 Bytes

Contents

module GraphQL
  module Introspection
    # A wrapper to create `__type(name: )` dynamically.
    class TypeByNameField
      def self.create(type_hash)
        GraphQL::Field.define do
          name("__type")
          description("A type in the GraphQL system")
          type(GraphQL::Introspection::TypeType)
          argument :name, !types.String
          resolve ->(o, args, c) { type_hash.fetch(args["name"], nil) }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql-1.0.0 lib/graphql/introspection/type_by_name_field.rb
graphql-0.19.4 lib/graphql/introspection/type_by_name_field.rb