meibo 0.24.0 → 0.25.1

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: 00f82e2a36647d4e79e1bc9df6a1a69b0c3bbc9a09d77fe89fa05680d8cf2998
4
- data.tar.gz: 5c363d7995a6e8c57afe83e6e77635ca7011c7c62528c486e5973b5c8a01ecbf
3
+ metadata.gz: 417a05d59791c055bc369d37c6090bf98415dc5eedeb30e4dc90ee599c281b5a
4
+ data.tar.gz: 0a85ffa046d4b09ceb65b8f610cc85496e6d4e00888e04c3c2bd75814d45d61b
5
5
  SHA512:
6
- metadata.gz: c2960714575f4ea47e52851b183245e775d043a9a02bd5eed559843a98abbcc303c74496693c999fa0bc5dc3ac421b626983e1bc75b54510f805b4087826a899
7
- data.tar.gz: f809d3d5e3149c35cd2f43af3bc4795664cd59a7d458f955e33d6ea00dd481ba3d9270365167ab1b27b48fd2f6b983a361915789109cc5c447c4753590b977d4
6
+ metadata.gz: 40f237fb1522c4dd583d6888f338010bf30baab627bc2b2627fe0e4434bf98c751e6b3b7ffc10a8828bd681ecf81a57bcb1f3687ffefc126031e980415101a9d
7
+ data.tar.gz: 0ea9ab746af1807bb28879a68bae54fbb7e074b533a0f76b127d8d5ad81d4a17d215f6c69ab1502e5451b87cfebd96d6a6fa36ca821df92c74fc2ecd061917e8
data/.rubocop_todo.yml CHANGED
@@ -50,7 +50,7 @@ Metrics/MethodLength:
50
50
  # Offense count: 1
51
51
  # Configuration parameters: CountComments, CountAsOne.
52
52
  Metrics/ModuleLength:
53
- Max: 231
53
+ Max: 237
54
54
 
55
55
  # Offense count: 16
56
56
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meibo (0.24.0)
4
+ meibo (0.25.1)
5
5
  csv (>= 3.1.4)
6
6
  rubyzip
7
7
  zeitwerk
@@ -38,8 +38,8 @@ module Meibo
38
38
 
39
39
  private
40
40
 
41
- def build_converter(fields:, converters:, write_or_parser:)
42
- converter_list = TYPES.filter_map do |converter_type|
41
+ def build_converter_list(fields:, converters:, write_or_parser:)
42
+ TYPES.filter_map do |converter_type|
43
43
  fields_to_be_converted = converters[converter_type]
44
44
  method_name = "build_#{converter_type}_field_#{write_or_parser}_converter"
45
45
  if fields_to_be_converted && respond_to?(method_name, true)
@@ -52,14 +52,22 @@ module Meibo
52
52
  end
53
53
  end
54
54
  end
55
+ end
56
+
57
+ def converter_list_to_convert_proc(converter_list)
55
58
  lambda do |field, field_info|
56
59
  # NOTE: convert blank sourcedId to nil
57
- field = nil if field.respond_to?(:empty?) && field.empty?
60
+ field = nil if field == "NULL" || field == "" # rubocop:disable Style/MultipleComparison
58
61
  converter_list.each { |converter| field = converter[field, field_info] }
59
62
  field
60
63
  end
61
64
  end
62
65
 
66
+ def build_converter(fields:, converters:, write_or_parser:)
67
+ converter_list = build_converter_list(fields: fields, converters: converters, write_or_parser: write_or_parser).freeze
68
+ converter_list_to_convert_proc(converter_list)
69
+ end
70
+
63
71
  def build_boolean_field_parser_converter(boolean_field_indexes)
64
72
  boolean_field_indexes = boolean_field_indexes.dup.freeze
65
73
  lambda do |field, field_info|
@@ -30,8 +30,7 @@ module Meibo
30
30
  }
31
31
  )
32
32
 
33
- def initialize(sourced_id:, name:, type:, status: nil, date_last_modified: nil, identifier: nil,
34
- parent_sourced_id: (type == TYPES[:district] ? "NULL" : nil), **extension_fields)
33
+ def initialize(sourced_id:, name:, type:, status: nil, date_last_modified: nil, identifier: nil, parent_sourced_id: nil, **extension_fields)
35
34
  @sourced_id = sourced_id
36
35
  @status = status
37
36
  @date_last_modified = date_last_modified
data/lib/meibo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Meibo
4
- VERSION = "0.24.0"
4
+ VERSION = "0.25.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meibo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0
4
+ version: 0.25.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seiei Miyagi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: csv
@@ -142,7 +142,7 @@ metadata:
142
142
  allowed_push_host: https://rubygems.org/
143
143
  homepage_uri: https://github.com/hanachin/meibo
144
144
  source_code_uri: https://github.com/hanachin/meibo
145
- changelog_uri: https://github.com/hanachin/meibo/blob/meibo/v0.24.0/CHANGELOG.md
145
+ changelog_uri: https://github.com/hanachin/meibo/blob/meibo/v0.25.1/CHANGELOG.md
146
146
  rubygems_mfa_required: 'true'
147
147
  post_install_message:
148
148
  rdoc_options: []