bulk_loader 1.3.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -2
- data/.rubocop.yml +6 -1
- data/lib/bulk_loader/dsl.rb +7 -9
- data/lib/bulk_loader/loader.rb +1 -1
- data/lib/bulk_loader/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f1d67abfc96cf07c2567f79aea5d9aa72a788a4eb1177cfb82f54a895645ba7
|
4
|
+
data.tar.gz: 7d35e81f819371a5cf2c2962f16b3b0be51c1ea6dd56bd209bcf4a548f9ea092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c6c1a2de3185b089168f03046fc115f523c80b4319b83c366cd58f40bb43c6719e7471c9890618c915b2a4be5983b3397f97e148b50114d997d6bfe0069d3c1
|
7
|
+
data.tar.gz: 4d1f5ee95f42cfc48967261c5af00214da6716f7a5b7602481de83ff740aa86c9e443af5f0924423bb2dda77ed19fbdbe115d4f7cebee7fb87a5008e0e58cf84
|
data/.github/workflows/ruby.yml
CHANGED
@@ -8,12 +8,12 @@ jobs:
|
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
strategy:
|
10
10
|
matrix:
|
11
|
-
ruby: ['2.
|
11
|
+
ruby: ['3.0', '2.7', '2.6', '2.5']
|
12
12
|
|
13
13
|
steps:
|
14
14
|
- uses: actions/checkout@v1
|
15
15
|
- name: Set up Ruby ${{ matrix.ruby }}
|
16
|
-
uses:
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
17
|
with:
|
18
18
|
ruby-version: ${{ matrix.ruby }}
|
19
19
|
- name: Build and test with Rake
|
data/.rubocop.yml
CHANGED
@@ -8,7 +8,9 @@ AllCops:
|
|
8
8
|
- 'Guardfile'
|
9
9
|
- 'bin/*'
|
10
10
|
- 'Rakefile'
|
11
|
+
- 'Steepfile'
|
11
12
|
- 'example/**/*'
|
13
|
+
NewCops: enable
|
12
14
|
|
13
15
|
Metrics/AbcSize:
|
14
16
|
Max: 22
|
@@ -20,8 +22,11 @@ Metrics/BlockLength:
|
|
20
22
|
Exclude:
|
21
23
|
- 'spec/**/*'
|
22
24
|
|
23
|
-
|
25
|
+
Layout/LineLength:
|
24
26
|
Max: 100
|
25
27
|
|
26
28
|
Style/Documentation:
|
27
29
|
Enabled: false
|
30
|
+
|
31
|
+
Lint/ConstantDefinitionInBlock:
|
32
|
+
Enabled: false
|
data/lib/bulk_loader/dsl.rb
CHANGED
@@ -6,7 +6,9 @@ module BulkLoader
|
|
6
6
|
# getter for +BulkLoader::ClassAttribute+
|
7
7
|
# If you pass name, mapping, options argument, you can define loader
|
8
8
|
# if you does not want to export name to object, pass export: false to options.
|
9
|
-
|
9
|
+
# if you would like to raise error when implicitly calling loader, pass autoload: false
|
10
|
+
# to options.
|
11
|
+
def bulk_loader(*args, export: nil, autoload: true, default: nil, &block)
|
10
12
|
@bulk_loader ||= if superclass.respond_to?(:bulk_loader)
|
11
13
|
superclass.bulk_loader.dup
|
12
14
|
else
|
@@ -15,16 +17,12 @@ module BulkLoader
|
|
15
17
|
|
16
18
|
return @bulk_loader if args.empty?
|
17
19
|
|
18
|
-
name, mapping
|
19
|
-
options ||= {}
|
20
|
-
does_export = options.delete(:export)
|
21
|
-
does_autoload = options.delete(:autoload)
|
22
|
-
does_autoload = true if does_autoload.nil?
|
20
|
+
name, mapping = *args
|
23
21
|
|
24
|
-
loader = BulkLoader::Loader.new(mapping,
|
25
|
-
@bulk_loader.define_loader(name, loader, autoload:
|
22
|
+
loader = BulkLoader::Loader.new(mapping, default: default, &block)
|
23
|
+
@bulk_loader.define_loader(name, loader, autoload: autoload)
|
26
24
|
|
27
|
-
return if
|
25
|
+
return if export == false
|
28
26
|
|
29
27
|
define_method name do
|
30
28
|
bulk_loader.public_send(name)
|
data/lib/bulk_loader/loader.rb
CHANGED
data/lib/bulk_loader/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bulk_loader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keiji Yoshimi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
156
|
+
rubygems_version: 3.2.3
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: utility to avoid N+1 queries
|