bulk_loader 1.3.1 → 2.0.0

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: db5beccbf865a19f4e39f911a63c625485558af4384e53c99fb42308270f8d74
4
- data.tar.gz: a943c873b30717596417101cf5defc45553dae1a7bf92ebd418d13f4e94a29e5
3
+ metadata.gz: 7f1d67abfc96cf07c2567f79aea5d9aa72a788a4eb1177cfb82f54a895645ba7
4
+ data.tar.gz: 7d35e81f819371a5cf2c2962f16b3b0be51c1ea6dd56bd209bcf4a548f9ea092
5
5
  SHA512:
6
- metadata.gz: 4d31ecc4703cd0f33f152e5f33cffe3a57e6a51952a42ad6a126ee6259acde7a524c3decbc5029b2a95ad577620745b8ba748d1812d25e2a4cc0eb98b2525027
7
- data.tar.gz: ebadc37264f2a8b3d2a7124dbfadc2c3f7d779b358e87d10963d0c520a3048eb6eaa03b032cafe5ca62193b8779def60d5e4a96d69a881e16051db0c0772cd8e
6
+ metadata.gz: 7c6c1a2de3185b089168f03046fc115f523c80b4319b83c366cd58f40bb43c6719e7471c9890618c915b2a4be5983b3397f97e148b50114d997d6bfe0069d3c1
7
+ data.tar.gz: 4d1f5ee95f42cfc48967261c5af00214da6716f7a5b7602481de83ff740aa86c9e443af5f0924423bb2dda77ed19fbdbe115d4f7cebee7fb87a5008e0e58cf84
@@ -8,12 +8,12 @@ jobs:
8
8
  runs-on: ubuntu-latest
9
9
  strategy:
10
10
  matrix:
11
- ruby: ['2.6.x', '2.5.x', '2.4.x']
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: actions/setup-ruby@v1
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
- Metrics/LineLength:
25
+ Layout/LineLength:
24
26
  Max: 100
25
27
 
26
28
  Style/Documentation:
27
29
  Enabled: false
30
+
31
+ Lint/ConstantDefinitionInBlock:
32
+ Enabled: false
@@ -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
- def bulk_loader(*args, &block)
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, options = *args
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, options, &block)
25
- @bulk_loader.define_loader(name, loader, autoload: does_autoload)
22
+ loader = BulkLoader::Loader.new(mapping, default: default, &block)
23
+ @bulk_loader.define_loader(name, loader, autoload: autoload)
26
24
 
27
- return if does_export == false
25
+ return if export == false
28
26
 
29
27
  define_method name do
30
28
  bulk_loader.public_send(name)
@@ -35,7 +35,7 @@ module BulkLoader
35
35
  end
36
36
  result_of = @block.call(mapping_of.keys, *args)
37
37
 
38
- raise 'block shuold return Hash' unless result_of.is_a?(Hash)
38
+ raise 'block should return Hash' unless result_of.is_a?(Hash)
39
39
 
40
40
  result_of
41
41
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BulkLoader
4
- VERSION = '1.3.1'
4
+ VERSION = '2.0.0'
5
5
  end
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: 1.3.1
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: 2019-10-11 00:00:00.000000000 Z
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.0.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