diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c552ecc..177bb23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,8 @@ on: - master pull_request: types: [opened, synchronize, reopened] + schedule: + - cron: '0 0 * * 1' jobs: lint: diff --git a/Rakefile b/Rakefile index c4c8b98..688df8c 100755 --- a/Rakefile +++ b/Rakefile @@ -52,7 +52,10 @@ task :create_zip_code_data do prefectures_to_zip[code] << [r0, r1] end + # rubocop:disable Style/HashConversion + # https://github.com/rubocop-hq/rubocop/issues/9526 prefectures_to_zip = Hash[*prefectures_to_zip.sort.flatten(1)] + # rubocop:enable Style/HashConversion # save result File.open('data/zip.yml', 'w') do |file| diff --git a/lib/jp_prefecture/zip_mapping.rb b/lib/jp_prefecture/zip_mapping.rb index 14521ac..1d44be2 100644 --- a/lib/jp_prefecture/zip_mapping.rb +++ b/lib/jp_prefecture/zip_mapping.rb @@ -7,7 +7,10 @@ module JpPrefecture module ZipMapping filepath = File.join(File.dirname(__FILE__), '../../data/zip.yml') @data = YAML.load_file(filepath) + # rubocop:disable Style/HashConversion + # https://github.com/rubocop-hq/rubocop/issues/9526 @data = Hash[*@data.collect { |code, arr| [code, arr.collect { |zip_from, zip_to| zip_from..zip_to }] }.flatten(1)] + # rubocop:enable Style/HashConversion def self.data JpPrefecture.config.zip_mapping_data || @data