Method: GraphQL::Client::Schema::PossibleTypes#initialize
- Defined in:
- lib/graphql/client/schema/possible_types.rb
#initialize(type, types) ⇒ PossibleTypes
Returns a new instance of PossibleTypes.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/graphql/client/schema/possible_types.rb', line 13 def initialize(type, types) @type = type unless types.is_a?(Enumerable) raise TypeError, "expected types to be Enumerable, but was #{types.class}" end @possible_types = {} types.each do |klass| unless klass.is_a?(ObjectType) raise TypeError, "expected type to be #{ObjectType}, but was #{type.class}" end @possible_types[klass.type.graphql_name] = klass end end |