Class: GraphQL::Client::Schema::InterfaceType
- Inherits:
-
Module
- Object
- Module
- GraphQL::Client::Schema::InterfaceType
- Includes:
- BaseType
- Defined in:
- lib/graphql/client/schema/interface_type.rb
Instance Attribute Summary
Attributes included from BaseType
Instance Method Summary collapse
- #define_class(definition, ast_nodes) ⇒ Object
-
#initialize(type) ⇒ InterfaceType
constructor
A new instance of InterfaceType.
- #new(types) ⇒ Object
Methods included from BaseType
#cast, #to_list_type, #to_non_null_type
Constructor Details
#initialize(type) ⇒ InterfaceType
Returns a new instance of InterfaceType.
11 12 13 14 15 16 17 |
# File 'lib/graphql/client/schema/interface_type.rb', line 11 def initialize(type) unless type.kind.interface? raise "expected type to be an Interface, but was #{type.class}" end @type = type end |
Instance Method Details
#define_class(definition, ast_nodes) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/graphql/client/schema/interface_type.rb', line 23 def define_class(definition, ast_nodes) possible_type_names = definition.client.possible_types(type).map(&:graphql_name) possible_types = possible_type_names.map { |concrete_type_name| schema_module.get_class(concrete_type_name).define_class(definition, ast_nodes) } new(possible_types) end |
#new(types) ⇒ Object
19 20 21 |
# File 'lib/graphql/client/schema/interface_type.rb', line 19 def new(types) PossibleTypes.new(type, types) end |