activerecord-prunable 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/activerecord-prunable.gemspec +1 -1
- data/lib/active_record/prunable.rb +11 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d40d467ab85540ecaf695bab2974816e41161e09
|
4
|
+
data.tar.gz: 70488ff303ea76a6bfc5c997523c76fef3d33a3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4cddff27a65443463d0f8e0d7ed0ee089e3dfa7b6e0903fe894a15d1a6155593760451ef48c03cab8a233b78ba4ba062d118c9373194d444160a846bdfb2a17
|
7
|
+
data.tar.gz: 51e402061a8349eeb1206931b5bb309e8c1959bdd8081d52da730d14312ff1242a63a5c5d69ee4ab2ed1aba3629552f5abb9092328a93c3c0c5d43e7bef09407
|
data/Gemfile.lock
CHANGED
@@ -30,14 +30,20 @@ module ActiveRecord
|
|
30
30
|
class_variable_set(:@@prune_method, method)
|
31
31
|
end
|
32
32
|
|
33
|
-
def prune_created_after(duration)
|
33
|
+
def prune_created_after(duration, batch_removal: nil, remove_in_batches: nil)
|
34
34
|
class_variable_set(:@@prune_created_after, duration)
|
35
|
+
|
36
|
+
batch_removal_arg = batch_removal || remove_in_batches
|
37
|
+
batch_removal(batch_removal_arg) if batch_removal_arg
|
35
38
|
end
|
36
39
|
|
37
40
|
alias prune_after prune_created_after
|
38
41
|
|
39
|
-
def prune_updated_after(duration)
|
42
|
+
def prune_updated_after(duration, batch_removal: nil, remove_in_batches: nil)
|
40
43
|
class_variable_set(:@@prune_updated_after, duration)
|
44
|
+
|
45
|
+
batch_removal_arg = batch_removal || remove_in_batches
|
46
|
+
batch_removal(batch_removal_arg) if batch_removal_arg
|
41
47
|
end
|
42
48
|
|
43
49
|
def prune!(*params, prune_method: nil, current_time: nil, batch_size: nil, in_batches: false)
|
@@ -58,9 +64,11 @@ module ActiveRecord
|
|
58
64
|
destroyed_records
|
59
65
|
end
|
60
66
|
|
61
|
-
def batch_removal(batch_size =
|
67
|
+
def batch_removal(batch_size = nil)
|
68
|
+
batch_size = 1000 unless batch_size.is_a?(Integer)
|
62
69
|
class_variable_set(:@@prunable_batch_size, batch_size)
|
63
70
|
end
|
71
|
+
alias remove_in_batches batch_removal
|
64
72
|
|
65
73
|
private
|
66
74
|
|