Module: ActiveRecord::Collections::Batching::ClassMethods

Defined in:
lib/active_record/collections/batching.rb

Instance Method Summary collapse

Instance Method Details

#batch(*num) ⇒ Object



27
28
29
# File 'lib/active_record/collections/batching.rb', line 27

def batch(*num)
  new.batch(*num)
end

#batch_by_default!Object



19
20
21
# File 'lib/active_record/collections/batching.rb', line 19

def batch_by_default!
  @batch_by_default = true
end

#batch_by_default?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/active_record/collections/batching.rb', line 23

def batch_by_default?
  @batch_by_default || false
end

#batch_size(num) ⇒ Object



31
32
33
# File 'lib/active_record/collections/batching.rb', line 31

def batch_size(num)
  new.batch_size(num)
end

#batching_threshold(threshold = nil) ⇒ Object



14
15
16
17
# File 'lib/active_record/collections/batching.rb', line 14

def batching_threshold(threshold=nil)
  @batching_threshold = threshold unless threshold.nil?
  @batching_threshold ||= 0
end

#default_batch_size(size = nil) ⇒ Object



9
10
11
12
# File 'lib/active_record/collections/batching.rb', line 9

def default_batch_size(size=nil)
  @default_batch_size = size unless size.nil?
  @default_batch_size ||= 500
end