Class: GroupChildSerializer
- Inherits:
-
BaseSerializer
- Object
- BaseSerializer
- GroupChildSerializer
- Includes:
- WithPagination
- Defined in:
- app/serializers/group_child_serializer.rb
Instance Attribute Summary collapse
-
#hierarchy_root ⇒ Object
readonly
Returns the value of attribute hierarchy_root.
-
#should_expand_hierarchy ⇒ Object
readonly
Returns the value of attribute should_expand_hierarchy.
Attributes included from WithPagination
Attributes inherited from BaseSerializer
Instance Method Summary collapse
- #expand_hierarchy(hierarchy_root = nil) ⇒ Object
- #represent(resource, opts = {}, entity_class = nil) ⇒ Object
Methods included from WithPagination
Methods inherited from BaseSerializer
Constructor Details
This class inherits a constructor from BaseSerializer
Instance Attribute Details
#hierarchy_root ⇒ Object (readonly)
Returns the value of attribute hierarchy_root.
6 7 8 |
# File 'app/serializers/group_child_serializer.rb', line 6 def hierarchy_root @hierarchy_root end |
#should_expand_hierarchy ⇒ Object (readonly)
Returns the value of attribute should_expand_hierarchy.
6 7 8 |
# File 'app/serializers/group_child_serializer.rb', line 6 def @should_expand_hierarchy end |
Instance Method Details
#expand_hierarchy(hierarchy_root = nil) ⇒ Object
10 11 12 13 14 15 |
# File 'app/serializers/group_child_serializer.rb', line 10 def (hierarchy_root = nil) @hierarchy_root = hierarchy_root @should_expand_hierarchy = true self end |
#represent(resource, opts = {}, entity_class = nil) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/serializers/group_child_serializer.rb', line 17 def represent(resource, opts = {}, entity_class = nil) if paginator.paginate(resource) if paginated? represent_hierarchies(resource, opts) else super(resource, opts) end end |