Class: ArSync::CollectionWithOrder
- Inherits:
-
ArSerializer::CustomSerializable
- Object
- ArSerializer::CustomSerializable
- ArSync::CollectionWithOrder
- Defined in:
- lib/ar_sync/collection.rb
Instance Method Summary collapse
-
#initialize(records, direction:, first: nil, last: nil) ⇒ CollectionWithOrder
constructor
A new instance of CollectionWithOrder.
Constructor Details
#initialize(records, direction:, first: nil, last: nil) ⇒ CollectionWithOrder
Returns a new instance of CollectionWithOrder.
54 55 56 57 58 59 60 61 |
# File 'lib/ar_sync/collection.rb', line 54 def initialize(records, direction:, first: nil, last: nil) super records do |results| { ordering: { direction: direction || :asc, first: first, last: last }.compact, collection: records.map(&results).compact } end end |