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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e6595644a9ff567d8112ea141c9c38bdc63ab15
4
- data.tar.gz: faf2f163b4307c8225910d17b2fae79d68f94c8c
3
+ metadata.gz: 9231fb008bae08691cdba972c7761547a91c8846
4
+ data.tar.gz: bc2a487e404e4de1ab70e554aba6916ada8262d9
5
5
  SHA512:
6
- metadata.gz: ea5daf395ee4155841cfabd96a666737e9cc79563e2098d434d9606d04fae73c3b7a883cd85bd35c0bac0f9f4f655f901504f32b436cd0971fd99ca78198c0c7
7
- data.tar.gz: ad27de72d8a94388f205a50d5b6b680bfa4007ac76f5acc4b5260a7023916e007d4055fa24c9e84c0c0ae7a5aadec8cc8adf65c84b692e1e3e427f048ae5f0a0
6
+ metadata.gz: 9e1844db17f1e58ae76e1352139a5a9f5ba2b63c7d6d796c631b46f98ace42fb0585403b962efbc42def14ef4b4f1ec6a3848a37c0e4074da8db444f83d21dfa
7
+ data.tar.gz: 3e5d2a08c0fb2fb94f24432c92b7affffcfb394bbff17402be50e7b10154cc829b32ee1d8a418e8b7f116b6aa52bf4b9f4f3993fcc478169942034700f81c661
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activerecord-records_on_load (0.1.4)
4
+ activerecord-records_on_load (0.1.5)
5
5
  activerecord
6
6
 
7
7
  GEM
@@ -3,19 +3,29 @@ module ActiveRecord
3
3
  def load(&block)
4
4
  super(&block)
5
5
 
6
- if @_on_load_blocks.present?
7
- @_on_load_blocks.each do |b|
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
- @_on_load_blocks ||= []
17
- @_on_load_blocks << block
18
- clone
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
@@ -1,5 +1,5 @@
1
1
  module Activerecord
2
2
  module RecordsOnLoad
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.5'
4
4
  end
5
5
  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
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-02 00:00:00.000000000 Z
11
+ date: 2019-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord