Skip to content

Commit 3fdc17e

Browse files
committed
Yarddoc.
1 parent cbdf7f6 commit 3fdc17e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lib/active_model/serializer/adapter/json_api.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def initialize(serializer, options = {})
4848
end
4949

5050
# Build JSON API document.
51+
# @return [Hash] document
5152
def serializable_hash(options = nil)
5253
options ||= {}
5354

@@ -83,7 +84,9 @@ def fragment_cache(cached_hash, non_cached_hash)
8384

8485
private
8586

86-
# Build a pair of arrays containing the primary and included resources.
87+
# Build the requested resource objects.
88+
# @return [Array, Array] Pair of arrays containing primary and included
89+
# resources objects respectively.
8790
#
8891
# @api private
8992
def resource_objects_for(serializer)
@@ -98,7 +101,8 @@ def resource_objects_for(serializer)
98101
end
99102
end
100103

101-
# Build a Hash<ResourceIdentifier, ResourceObject> containing all requested resources (primary and included).
104+
# Recursively build all requested resource objects.
105+
# @return [Hash<ResourceIdentifier, ResourceObject>] Hash of resource objects keyed by resource identifiers.
102106
#
103107
# @api private
104108
def _resource_objects_for(serializer, include_tree, is_primary, hashes = {})
@@ -125,6 +129,7 @@ def _resource_objects_for(serializer, include_tree, is_primary, hashes = {})
125129
end
126130

127131
# Transform a serializer into a resource object.
132+
# @return [Hash] resource object
128133
#
129134
# @api private
130135
def resource_object_for(serializer)
@@ -144,6 +149,7 @@ def resource_object_for(serializer)
144149
end
145150

146151
# Get resource type.
152+
# @return [String] type
147153
#
148154
# @api private
149155
def resource_identifier_type_for(serializer)
@@ -156,6 +162,7 @@ def resource_identifier_type_for(serializer)
156162
end
157163

158164
# Get resource id.
165+
# @return [String] id
159166
#
160167
# @api private
161168
def resource_identifier_id_for(serializer)
@@ -167,6 +174,7 @@ def resource_identifier_id_for(serializer)
167174
end
168175

169176
# Get resource identifier.
177+
# @return [Hash] resource identifier
170178
#
171179
# @api private
172180
def resource_identifier_for(serializer)
@@ -177,6 +185,7 @@ def resource_identifier_for(serializer)
177185
end
178186

179187
# Get resource attributes.
188+
# @return [Hash] attributes
180189
#
181190
# @api private
182191
def attributes_for(serializer)
@@ -189,6 +198,7 @@ def attributes_for(serializer)
189198
end
190199

191200
# Get resource linkage for an association.
201+
# @return [Hash] linkage
192202
#
193203
# @api private
194204
def linkage_for(serializer, options = {})
@@ -204,6 +214,7 @@ def linkage_for(serializer, options = {})
204214
end
205215

206216
# Get resource relationships.
217+
# @return [Hash] relationships
207218
#
208219
# @api private
209220
def relationships_for(serializer)

0 commit comments

Comments
 (0)