verified_holidays 0.1.1 → 0.1.2

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: 944420c7b9c7c781545fd7cba415430d2f1120cd9ee546a7b7d78ae9724847f0
4
+ data.tar.gz: 59b34d3f385a68881d8d33c93c9332ca3cf034f282c3a606a50e4bc752240d2d
5
5
  SHA512:
6
- metadata.gz: 8b6a69a1ca539758c638970683cb3a8607ab92c7c5b5dfc3cd1843ef00d182d13c99f8ac8bbb6a9098f5817da88eeaf60287e4f9d9f0ab4a304a6b4a980aef0f
7
- data.tar.gz: b49eb50dafd86bb27d1807cdd6d2ac2ec9cf42fec8a371435d9e40bc976374f86cff0bb182af4d022771188d12e34ae2789431d30983792bca5bcc55eeeb48e7
6
+ metadata.gz: 9471bd8cbafe922cd5f878f755e8ca1e289c2097dedd2336828ca1492ad6f74a9a21f75d27b221238f40da65461eb6dd88ea9ae360d0e8126c8ad742158920b2
7
+ data.tar.gz: f9b8c96b9df0d1163668ecff3b6de041513fc89397a33527c46be009e0f29ca5780765ddee5f8dc37127005d2ee1ff60943518665c7fe9a4f7e36220b8b1d540
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.2] - 2026-03-29
4
+
5
+ - Add SimpleCov with 90% minimum coverage threshold (line and branch)
6
+ - Add edge case tests for CSV parsing, Holiday model, Verifier, and main API
7
+ - Inline `CabinetOffice.parse_date` using `Date.strptime`
8
+ - Add `CabinetOffice.presence` to handle blank CSV fields
9
+ - Use `minmax` in `Verifier.filter_local_data`
10
+ - Simplify `Dataset#name` to one-liner
11
+
3
12
  ## [0.1.1] - 2026-03-23
4
13
 
5
14
  - 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[0])
35
+ name = presence(row[1])
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.2'
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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenta Ishizaki