Sha256: 5f3705b01035238444fb64c5610fb94422efe0f512b042213126661c64fc1974

Contents?: true

Size: 622 Bytes

Versions: 6

Compression:

Stored size: 622 Bytes

Contents

module GraphQL
  # A collection of {ObjectType}s
  #
  # @example a union of types
  #
  #   PetUnion = GraphQL::UnionType.define do
  #     name "Pet"
  #     description "Animals that live in your house"
  #     possible_types [DogType, CatType, FishType]
  #   end
  #
  class UnionType < GraphQL::BaseType
    include GraphQL::BaseType::HasPossibleTypes
    attr_accessor :name, :description, :possible_types
    accepts_definitions :possible_types, :resolve_type

    def kind
      GraphQL::TypeKinds::UNION
    end

    def include?(child_type_defn)
      possible_types.include?(child_type_defn)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
graphql-0.14.2 lib/graphql/union_type.rb
graphql-0.15.1 lib/graphql/union_type.rb
graphql-0.15.0 lib/graphql/union_type.rb
graphql-0.14.1 lib/graphql/union_type.rb
graphql-0.14.0 lib/graphql/union_type.rb
graphql-0.13.0 lib/graphql/union_type.rb