Class: GraphQL::Language::FragmentDefinition
- Inherits:
-
Struct
- Object
- Struct
- GraphQL::Language::FragmentDefinition
- Defined in:
- lib/graphql/language/fragment_definition.rb
Instance Attribute Summary collapse
-
#directives ⇒ Object
Returns the value of attribute directives.
-
#name ⇒ Object
Returns the value of attribute name.
-
#selection_set ⇒ Object
Returns the value of attribute selection_set.
-
#type_condition ⇒ Object
Returns the value of attribute type_condition.
Instance Method Summary collapse
-
#apply?(context, object_type) ⇒ Boolean
GraphQL Specification 6.3 Evaluating selection sets doesFragmentTypeApply implementation objectType, fragmentType = self.type_condition => Schema.type + context[schema, document].
Instance Attribute Details
#directives ⇒ Object
Returns the value of attribute directives
3 4 5 |
# File 'lib/graphql/language/fragment_definition.rb', line 3 def directives @directives end |
#name ⇒ Object
Returns the value of attribute name
3 4 5 |
# File 'lib/graphql/language/fragment_definition.rb', line 3 def name @name end |
#selection_set ⇒ Object
Returns the value of attribute selection_set
3 4 5 |
# File 'lib/graphql/language/fragment_definition.rb', line 3 def selection_set @selection_set end |
#type_condition ⇒ Object
Returns the value of attribute type_condition
3 4 5 |
# File 'lib/graphql/language/fragment_definition.rb', line 3 def type_condition @type_condition end |
Instance Method Details
#apply?(context, object_type) ⇒ Boolean
GraphQL Specification
6.3 Evaluating selection sets
doesFragmentTypeApply implementation
objectType, fragmentType = self.type_condition => Schema.type
+ context[schema, document]
11 12 13 14 15 16 17 18 19 |
# File 'lib/graphql/language/fragment_definition.rb', line 11 def apply?(context, object_type) type = context[:schema].type(type_condition.type) return type == object_type if type.is_a?(GraphQLObjectType) return type.possible_type?(object_type) if type.is_a?(GraphQLInterfaceType) return type.possible_type?(object_type) if type.is_a?(GraphQLUnionType) end |