Sha256: d922d871d096a270c96863c610f410fbc2175ea9bd5237eb31851b449e489573

Contents?: true

Size: 679 Bytes

Versions: 26

Compression:

Stored size: 679 Bytes

Contents

# A wrapper to create `__type(name: )` dynamically.
class GraphQL::Introspection::TypeByNameField
  DEFINITION = Proc.new { |f, type, field, arg, type_hash|
    f.name("__type")
    f.description("A type in the GraphQL system")
    f.arguments({name: arg.build(type: !type.String)})
    f.type(!GraphQL::Introspection::TypeType)
    f.resolve -> (o, args, c) { type_hash[args["name"]] }
  }

  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[args["name"]] }
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
graphql-0.12.1 lib/graphql/introspection/type_by_name_field.rb
graphql-0.12.0 lib/graphql/introspection/type_by_name_field.rb
graphql-0.11.1 lib/graphql/introspection/type_by_name_field.rb
graphql-0.11.0 lib/graphql/introspection/type_by_name_field.rb
graphql-0.10.9 lib/graphql/introspection/type_by_name_field.rb
graphql-0.10.8 lib/graphql/introspection/type_by_name_field.rb
graphql-0.10.7 lib/graphql/introspection/type_by_name_field.rb
graphql-0.10.6 lib/graphql/introspection/type_by_name_field.rb
graphql-0.10.5 lib/graphql/introspection/type_by_name_field.rb
graphql-0.10.4 lib/graphql/introspection/type_by_name_field.rb
graphql-0.10.3 lib/graphql/introspection/type_by_name_field.rb
graphql-0.10.2 lib/graphql/introspection/type_by_name_field.rb
graphql-0.10.1 lib/graphql/introspection/type_by_name_field.rb
graphql-0.10.0 lib/graphql/introspection/type_by_name_field.rb
graphql-0.9.5 lib/graphql/introspection/type_by_name_field.rb
graphql-0.9.4 lib/graphql/introspection/type_by_name_field.rb
graphql-0.9.3 lib/graphql/introspection/type_by_name_field.rb
graphql-0.9.2 lib/graphql/introspection/type_by_name_field.rb
graphql-0.8.1 lib/graphql/introspection/type_by_name_field.rb
graphql-0.8.0 lib/graphql/introspection/type_by_name_field.rb