activerecord-records_on_load 0.1.4 → 0.1.5
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/lib/active_record/records_on_load.rb +17 -7
- data/lib/activerecord-records_on_load/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9231fb008bae08691cdba972c7761547a91c8846
|
4
|
+
data.tar.gz: bc2a487e404e4de1ab70e554aba6916ada8262d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e1844db17f1e58ae76e1352139a5a9f5ba2b63c7d6d796c631b46f98ace42fb0585403b962efbc42def14ef4b4f1ec6a3848a37c0e4074da8db444f83d21dfa
|
7
|
+
data.tar.gz: 3e5d2a08c0fb2fb94f24432c92b7affffcfb394bbff17402be50e7b10154cc829b32ee1d8a418e8b7f116b6aa52bf4b9f4f3993fcc478169942034700f81c661
|
data/Gemfile.lock
CHANGED
@@ -3,19 +3,29 @@ module ActiveRecord
|
|
3
3
|
def load(&block)
|
4
4
|
super(&block)
|
5
5
|
|
6
|
-
|
7
|
-
@
|
8
|
-
b.call(@records)
|
9
|
-
end
|
6
|
+
on_load_block_values.each do |block|
|
7
|
+
block.call(@records)
|
10
8
|
end
|
11
9
|
|
12
10
|
self
|
13
11
|
end
|
14
12
|
|
15
13
|
def on_load(&block)
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
raise ArgumentError, 'The method .on_load() must contain block argument.' unless block
|
15
|
+
spawn.on_load!(&block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def on_load!(&block)
|
19
|
+
self.on_load_block_values += [block]
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
def on_load_block_values
|
24
|
+
@on_load_block_values || []
|
25
|
+
end
|
26
|
+
|
27
|
+
def on_load_block_values=(value)
|
28
|
+
@on_load_block_values = value
|
19
29
|
end
|
20
30
|
end
|
21
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-records_on_load
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jun0kada
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|