Method: ArSync::Collection#initialize

Defined in:
lib/ar_sync/collection.rb

#initialize(klass, name, first: nil, last: nil, direction: nil) ⇒ Collection

Returns a new instance of Collection.



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/ar_sync/collection.rb', line 3

def initialize(klass, name, first: nil, last: nil, direction: nil)
  direction ||= :asc
  @klass = klass
  @name = name
  @first = first
  @last = last
  @direction = direction
  @ordering = { first: first, last: last, direction: direction }.compact
  self.class.defined_collections[[klass, name]] = self
  define_singleton_method(name) { to_a }
end