Class: GraphQL::Schema::TypeMembership
- Inherits:
-
Object
- Object
- GraphQL::Schema::TypeMembership
- Defined in:
- lib/graphql/schema/type_membership.rb
Overview
This class joins an object type to an abstract type (interface or union) of which it is a member.
TODO: Not yet implemented for interfaces.
Instance Attribute Summary collapse
-
#abstract_type ⇒ Class<GraphQL::Schema::Union>, Module<GraphQL::Schema::Interface>
readonly
-
#object_type ⇒ Class<GraphQL::Schema::Object>
Instance Method Summary collapse
-
#initialize(abstract_type, object_type, **options) ⇒ TypeMembership
constructor
Called when an object is hooked up to an abstract type, such as Union.possible_types or Object.implements (for interfaces).
-
#visible?(_ctx) ⇒ Boolean
If false, #object_type will be treated as not a member of #abstract_type.
Constructor Details
#initialize(abstract_type, object_type, **options) ⇒ TypeMembership
Called when an object is hooked up to an abstract type, such as Union.possible_types or Object.implements (for interfaces).
22 23 24 25 26 |
# File 'lib/graphql/schema/type_membership.rb', line 22 def initialize(abstract_type, object_type, **) @abstract_type = abstract_type @object_type = object_type @options = end |
Instance Attribute Details
#abstract_type ⇒ Class<GraphQL::Schema::Union>, Module<GraphQL::Schema::Interface> (readonly)
14 15 16 |
# File 'lib/graphql/schema/type_membership.rb', line 14 def abstract_type @abstract_type end |
#object_type ⇒ Class<GraphQL::Schema::Object>
11 12 13 |
# File 'lib/graphql/schema/type_membership.rb', line 11 def object_type @object_type end |
Instance Method Details
#visible?(_ctx) ⇒ Boolean
Returns if false, #object_type will be treated as not a member of #abstract_type.
29 30 31 |
# File 'lib/graphql/schema/type_membership.rb', line 29 def visible?(_ctx) true end |