Class: GraphQLActiveRecordResolvers::GraphQLAssociation
- Inherits:
-
Object
- Object
- GraphQLActiveRecordResolvers::GraphQLAssociation
- Defined in:
- lib/graphql_activerecord_resolvers/graphql_association.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#selections ⇒ Object
readonly
Returns the value of attribute selections.
Instance Method Summary collapse
- #build_includes_tree ⇒ Object
-
#initialize(schema:, klass:, field:, selections:, root:) ⇒ GraphQLAssociation
constructor
A new instance of GraphQLAssociation.
Constructor Details
#initialize(schema:, klass:, field:, selections:, root:) ⇒ GraphQLAssociation
Returns a new instance of GraphQLAssociation.
5 6 7 8 9 10 11 |
# File 'lib/graphql_activerecord_resolvers/graphql_association.rb', line 5 def initialize(schema:, klass:, field:, selections:, root:) @klass = klass @schema = schema @field = field @selections = selections @root = root end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
3 4 5 |
# File 'lib/graphql_activerecord_resolvers/graphql_association.rb', line 3 def field @field end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
3 4 5 |
# File 'lib/graphql_activerecord_resolvers/graphql_association.rb', line 3 def klass @klass end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
3 4 5 |
# File 'lib/graphql_activerecord_resolvers/graphql_association.rb', line 3 def root @root end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
3 4 5 |
# File 'lib/graphql_activerecord_resolvers/graphql_association.rb', line 3 def schema @schema end |
#selections ⇒ Object (readonly)
Returns the value of attribute selections.
3 4 5 |
# File 'lib/graphql_activerecord_resolvers/graphql_association.rb', line 3 def selections @selections end |
Instance Method Details
#build_includes_tree ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/graphql_activerecord_resolvers/graphql_association.rb', line 13 def build_includes_tree if root child_associations.map(&:build_includes_tree) elsif child_associations.any? { field.name => child_associations.map(&:build_includes_tree), } else field.name end end |