Class: JSONAPI::ResourceIdTree
- Inherits:
-
Object
- Object
- JSONAPI::ResourceIdTree
- Defined in:
- lib/jsonapi/resource_id_tree.rb
Overview
A tree structure representing the resource structure of the requested resource(s). This is an intermediate structure used to keep track of the resources, by identity, found at different included relationships. It will be flattened and the resource instances will be fetched from the cache or the record store.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#fragments ⇒ Object
readonly
Returns the value of attribute fragments.
-
#related_resource_id_trees ⇒ Object
readonly
Returns the value of attribute related_resource_id_trees.
Instance Method Summary collapse
-
#fetch_related_resource_id_tree(relationship) ⇒ JSONAPI::RelatedResourceIdTree
Gets the related Resource Id Tree for a relationship, and creates it first if it does not exist.
Instance Attribute Details
#fragments ⇒ Object (readonly)
Returns the value of attribute fragments.
8 9 10 |
# File 'lib/jsonapi/resource_id_tree.rb', line 8 def fragments @fragments end |
#related_resource_id_trees ⇒ Object (readonly)
Returns the value of attribute related_resource_id_trees.
8 9 10 |
# File 'lib/jsonapi/resource_id_tree.rb', line 8 def @related_resource_id_trees end |
Instance Method Details
#fetch_related_resource_id_tree(relationship) ⇒ JSONAPI::RelatedResourceIdTree
Gets the related Resource Id Tree for a relationship, and creates it first if it does not exist
15 16 17 18 |
# File 'lib/jsonapi/resource_id_tree.rb', line 15 def (relationship) relationship_name = relationship.name.to_sym @related_resource_id_trees[relationship_name] ||= RelatedResourceIdTree.new(relationship, self) end |