Class: ArSync::CollectionWithOrder

Inherits:
ArSerializer::CustomSerializable
  • Object
show all
Defined in:
lib/ar_sync/collection.rb

Instance Method Summary collapse

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