miscellany 0.1.5 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e57424c3b049c0f32faf8cf0a7e0f7f85145de07dc8ac09e61b2c2c3b8dd926
|
4
|
+
data.tar.gz: 52c108a746be070473df4bc9c4bad66daf216809e72dea58a628b2c94d14923d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9d8ddae9f677caa1c1c689a85abefaa64beb46cac97e9005be62c68b709ebe02bfb26791344bb58ab13cf6a557024d12bd8cbe667e88097c466cacf5148b31e
|
7
|
+
data.tar.gz: a8fe4f104a46d80c2af4fb0421716d34359fb0fabf35cb362b4ed33e284ee20a09054ec12fa14340127cadbf57c21e2982f6ed89459de54b7bf576eca395b501
|
@@ -32,7 +32,7 @@ module Miscellany
|
|
32
32
|
def bulk_destroy_internal(items, **kwargs)
|
33
33
|
options = {}
|
34
34
|
options.merge!(kwargs)
|
35
|
-
ClassCallbackExector.run_callbacks(model_class, :bulk_destroy, options: options) do
|
35
|
+
ClassCallbackExector.run_callbacks(model_class, :bulk_destroy, { options: options }) do
|
36
36
|
if items.respond_to?(:find_in_batches)
|
37
37
|
items.find_in_batches do |batch|
|
38
38
|
_destroy_batch(batch, options)
|
@@ -47,6 +47,7 @@ module Miscellany
|
|
47
47
|
ClassCallbackExector.run_callbacks(model_class, :destroy_batch, {
|
48
48
|
model_class: model_class,
|
49
49
|
batch: batch,
|
50
|
+
options: options,
|
50
51
|
}) do
|
51
52
|
model_class.destroy_bulk_batch(batch, options)
|
52
53
|
end
|
@@ -84,7 +85,6 @@ module Miscellany
|
|
84
85
|
env[k]
|
85
86
|
end
|
86
87
|
end
|
87
|
-
@options = options
|
88
88
|
end
|
89
89
|
|
90
90
|
def self.run_callbacks(cls, callback, env={}, &blk)
|
@@ -35,14 +35,15 @@ module Miscellany
|
|
35
35
|
comp = model.get_defined_computed(k)
|
36
36
|
raise "Undefined ComputedColum :#{k}" if comp.nil?
|
37
37
|
|
38
|
-
builder = ComputedBuilder.new(k, v, &comp)
|
38
|
+
builder = ComputedBuilder.new(all, k, v, &comp)
|
39
39
|
builder.apply(query)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
class ComputedBuilder
|
45
|
-
def initialize(key, args, &blk)
|
45
|
+
def initialize(relation, key, args, &blk)
|
46
|
+
@relation = relation
|
46
47
|
@key = key
|
47
48
|
@args = args.is_a?(Array) ? args : [args]
|
48
49
|
@block = blk
|
@@ -55,7 +56,7 @@ module Miscellany
|
|
55
56
|
raise "Must provide either a value or a block" if arg == :not_given && !blk
|
56
57
|
|
57
58
|
if arg == :not_given
|
58
|
-
arg = blk
|
59
|
+
arg = @relation.instance_eval(&blk)
|
59
60
|
end
|
60
61
|
|
61
62
|
@compiled[m] = arg
|
data/lib/miscellany/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miscellany
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan Knapp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|