Class: GraphQL::Client::Schema::InterfaceType

Inherits:
Module
  • Object
show all
Includes:
BaseType
Defined in:
lib/graphql/client/schema/interface_type.rb

Instance Attribute Summary

Attributes included from BaseType

#schema_module, #type

Instance Method Summary collapse

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.is_a?(GraphQL::InterfaceType)
    raise "expected type to be a GraphQL::InterfaceType, but was #{type.class}"
  end

  @type = type
end

Instance Method Details

#define_class(definition, irep_node) ⇒ Object



23
24
25
26
27
# File 'lib/graphql/client/schema/interface_type.rb', line 23

def define_class(definition, irep_node)
  new(irep_node.typed_children.keys.map { |ctype|
    schema_module.get_class(ctype.name).define_class(definition, irep_node)
  })
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