Class: GraphQL::Introspection::TypeByNameField
- Inherits:
-
Object
- Object
- GraphQL::Introspection::TypeByNameField
- Defined in:
- lib/graph_ql/introspection/type_by_name_field.rb
Overview
A wrapper to create ‘__type(name: )` dynamically.
Constant Summary collapse
- 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"]] } }
Class Method Summary collapse
Class Method Details
.create(type_hash) ⇒ Object
11 12 13 |
# File 'lib/graph_ql/introspection/type_by_name_field.rb', line 11 def self.create(type_hash) GraphQL::Field.new { |f, type, field, arg| DEFINITION.call(f, type, field, arg, type_hash) } end |