verified_holidays 0.1.1 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35ed277bdc90b64e40482d3f5ed051fc011f4b59ab19a4caa7b8e2b3384b8fb0
4
- data.tar.gz: 48b0bbf1e177a1837f0112d5b6a37f62273de4a0abeaae093dbf3280cf694f7c
3
+ metadata.gz: 3c4b96d4d17e79668560eeb7802ba564d832a9ea991048509be14b38c3e990aa
4
+ data.tar.gz: e4da942e6a8407669184e28b1ec9a6f85a470ae902201a34c298e7e84b922770
5
5
  SHA512:
6
- metadata.gz: 8b6a69a1ca539758c638970683cb3a8607ab92c7c5b5dfc3cd1843ef00d182d13c99f8ac8bbb6a9098f5817da88eeaf60287e4f9d9f0ab4a304a6b4a980aef0f
7
- data.tar.gz: b49eb50dafd86bb27d1807cdd6d2ac2ec9cf42fec8a371435d9e40bc976374f86cff0bb182af4d022771188d12e34ae2789431d30983792bca5bcc55eeeb48e7
6
+ metadata.gz: 807e383ef6bc891b24fab822a118360c15ac68ee9e87ab209616defb576d1344e4e7b4d8edaaa5941022efd6633cf67b580ba88fa3f1ddfa71e6d4b0e442e502
7
+ data.tar.gz: cd3945ab06bdfc181a7fa58a858f697c6816519848f9175415eae388336e6b597d6b2f2d455245518e74442e7e39e94963bef10670ec6b99a04d80b552d02f2a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.3] - 2026-03-29
4
+
5
+ - Replace numeric index access with header name access in `CabinetOffice.parse`
6
+ - Add Auto Release workflow
7
+ - Add auto-labeler workflows (file path labeler + branch prefix labeler)
8
+
9
+ ## [0.1.2] - 2026-03-29
10
+
11
+ - Add SimpleCov with 90% minimum coverage threshold (line and branch)
12
+ - Add edge case tests for CSV parsing, Holiday model, Verifier, and main API
13
+ - Inline `CabinetOffice.parse_date` using `Date.strptime`
14
+ - Add `CabinetOffice.presence` to handle blank CSV fields
15
+ - Use `minmax` in `Verifier.filter_local_data`
16
+ - Simplify `Dataset#name` to one-liner
17
+
3
18
  ## [0.1.1] - 2026-03-23
4
19
 
5
20
  - Move repository to GitHub Organization: `verified-holidays/verified_holidays`
@@ -23,22 +23,21 @@ module VerifiedHolidays
23
23
  parse(utf8)
24
24
  end
25
25
 
26
+ def self.presence(str)
27
+ str&.strip&.then { |s| s unless s.empty? }
28
+ end
29
+ private_class_method :presence
30
+
26
31
  def self.parse(csv_string)
27
32
  holidays = {}
28
33
  CSV.parse(csv_string, headers: true) do |row|
29
- date_str = row[0]&.strip
30
- name = row[1]&.strip
34
+ date_str = presence(row['国民の祝日・休日月日'])
35
+ name = presence(row['国民の祝日・休日名称'])
31
36
  next if date_str.nil? || name.nil?
32
37
 
33
- holidays[parse_date(date_str)] = name
38
+ holidays[Date.strptime(date_str, '%Y/%m/%d')] = name
34
39
  end
35
40
  holidays
36
41
  end
37
-
38
- def self.parse_date(date_str)
39
- parts = date_str.split('/')
40
- Date.new(parts[0].to_i, parts[1].to_i, parts[2].to_i)
41
- end
42
- private_class_method :parse_date
43
42
  end
44
43
  end
@@ -29,8 +29,7 @@ module VerifiedHolidays
29
29
  end
30
30
 
31
31
  def name(date)
32
- holiday = @holidays[to_date(date)]
33
- holiday&.name
32
+ @holidays[to_date(date)]&.name
34
33
  end
35
34
 
36
35
  def year(year)
@@ -27,9 +27,7 @@ module VerifiedHolidays
27
27
  end
28
28
 
29
29
  def self.filter_local_data(cabinet_data)
30
- cabinet_dates = cabinet_data.keys
31
- min_date = cabinet_dates.min
32
- max_date = cabinet_dates.max
30
+ min_date, max_date = cabinet_data.keys.minmax
33
31
 
34
32
  Dataset.instance.all.select { |date, _| date.between?(min_date, max_date) }
35
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VerifiedHolidays
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: verified_holidays
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenta Ishizaki