Class: PaginatedSerializer::Serializer
- Inherits:
-
Object
- Object
- PaginatedSerializer::Serializer
- Defined in:
- lib/paginated_serializer/serializer.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
Returns the value of attribute collection.
Instance Method Summary collapse
-
#initialize(collection) ⇒ Serializer
constructor
A new instance of Serializer.
- #to_json ⇒ Object
Constructor Details
#initialize(collection) ⇒ Serializer
Returns a new instance of Serializer.
8 9 10 |
# File 'lib/paginated_serializer/serializer.rb', line 8 def initialize(collection) @collection = collection end |
Instance Attribute Details
#collection ⇒ Object
Returns the value of attribute collection.
6 7 8 |
# File 'lib/paginated_serializer/serializer.rb', line 6 def collection @collection end |
Instance Method Details
#to_json ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/paginated_serializer/serializer.rb', line 12 def to_json { per_page: per_page, total: total, total_pages: total_pages, last_page: last_page, current_page: current_page, first_page: first_page, next_page: next_page, previous_page: previous_page }.merge(collection_json) end |