holiday_jp 0.5.0 → 0.8.0

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
- SHA1:
3
- metadata.gz: 3a83adb4ef5301da1296e6408f84bfea48f136ad
4
- data.tar.gz: a0d0ae34f282ace55bc8e11d0d48dfba7beac6c6
2
+ SHA256:
3
+ metadata.gz: 32d70e14a9053f50182b13a99e481431fd9180fb28b02fcd0ba042959fbb1819
4
+ data.tar.gz: 60d36bf1854b72e50e32fb1c61f71c5d23925f96bfbc81184c5c86b363190a2c
5
5
  SHA512:
6
- metadata.gz: dabfedac54118b70a47f1915ecf9db495b28c42118178db3ce934d6192ef46c9ba9321f6ebe90da016e35d9008e5ec3df226a20c11def09a3cf7a5edfd9b50b3
7
- data.tar.gz: a2fd4fd308deff957519485a863f39e45071957b30265adc88511eaac3b303f1c205ed5af79842f8f2e71e869270eaa390bd78edd133a7b25689ab71435dd614
6
+ metadata.gz: 032dbec25f732d8b880406cfb52c343ced173c0205e57c69d179c5be9e1b8af68b68c30b48ddab86b4585070b035047d63dcd446e3fe4ae492dcc414d5a9b879
7
+ data.tar.gz: 792dcf1441024706b7c41b879d1679d7e9b7bb2f7665ec477e44287da5698ed6af5adc1664b97085906a7687a55c90f2bb54fb2db14cd06932da2b670a236cbd
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: test
3
+
4
+ on:
5
+ push:
6
+ schedule:
7
+ - cron: '0 1 * * *'
8
+
9
+ jobs:
10
+ job-test:
11
+ name: Test
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ ruby-version: [ '2.4', '2.5', '2.6', '2.7' ]
16
+ steps:
17
+ - uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby-version }}
20
+
21
+ - name: Check out source code
22
+ uses: actions/checkout@v2
23
+
24
+ - name: Setup
25
+ run: |
26
+ git submodule update --init
27
+ gem install bundler -v '~> 1.6'
28
+ bundle install
29
+
30
+ - name: Run test
31
+ run: bundle exec rake test
@@ -0,0 +1,3 @@
1
+ [submodule "holiday_jp"]
2
+ path = test/holiday_jp
3
+ url = https://github.com/holiday-jp/holiday_jp.git
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # holiday_jp [<img src="https://secure.travis-ci.org/komagata/holiday_jp.png"/>](http://travis-ci.org/komagata/holiday_jp)
1
+ # holiday_jp [![test](https://github.com/holiday-jp/holiday_jp-ruby/workflows/test/badge.svg)](https://github.com/holiday-jp/holiday_jp-ruby/actions)
2
2
 
3
3
  Get holidays in Japan.
4
4
 
@@ -13,8 +13,28 @@ HolidayJp.holiday?(Date.new(2016, 8 ,11)) # true
13
13
  ## Supported Ruby Version
14
14
  Ruby 1.9.3+
15
15
 
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ ```ruby
21
+ gem 'holiday_jp'
22
+ ```
23
+
24
+ And then execute:
25
+
26
+ ```sh
27
+ $ bundle
28
+ ```
29
+
30
+ Or install it yourself as:
31
+
32
+ ```sh
33
+ $ gem install holiday_jp
34
+ ```
35
+
16
36
  ## Note on Patches/Pull Requests
17
-
37
+
18
38
  * Fork the project.
19
39
  * Make your feature addition or bug fix.
20
40
  * Add tests for it. This is important so I don't break it in a
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
19
  s.require_paths = ['lib']
20
20
 
21
- s.add_development_dependency 'bundler', '~> 1.6'
21
+ s.add_development_dependency 'bundler', '< 3.0'
22
22
  s.add_development_dependency 'rake'
23
23
  s.add_development_dependency 'test-unit', '3.0.9'
24
24
  end
@@ -1,3 +1,4 @@
1
+ ---
1
2
  1970-01-01: 元日
2
3
  1970-01-15: 成人の日
3
4
  1970-02-11: 建国記念の日
@@ -257,7 +258,7 @@
257
258
  1989-01-15: 成人の日
258
259
  1989-01-16: 振替休日
259
260
  1989-02-11: 建国記念の日
260
- 1989-02-24: 昭和天皇の大喪の礼
261
+ 1989-02-24: 大喪の礼
261
262
  1989-03-21: 春分の日
262
263
  1989-04-29: みどりの日
263
264
  1989-05-03: 憲法記念日
@@ -327,7 +328,7 @@
327
328
  1993-05-03: 憲法記念日
328
329
  1993-05-04: 国民の休日
329
330
  1993-05-05: こどもの日
330
- 1993-06-09: 皇太子徳仁親王の結婚の儀
331
+ 1993-06-09: 結婚の儀
331
332
  1993-09-15: 敬老の日
332
333
  1993-09-23: 秋分の日
333
334
  1993-10-10: 体育の日
@@ -720,7 +721,6 @@
720
721
  2017-01-02: 振替休日
721
722
  2017-01-09: 成人の日
722
723
  2017-02-11: 建国記念の日
723
- 2017-02-23: 天皇誕生日
724
724
  2017-03-20: 春分の日
725
725
  2017-04-29: 昭和の日
726
726
  2017-05-03: 憲法記念日
@@ -733,11 +733,11 @@
733
733
  2017-10-09: 体育の日
734
734
  2017-11-03: 文化の日
735
735
  2017-11-23: 勤労感謝の日
736
+ 2017-12-23: 天皇誕生日
736
737
  2018-01-01: 元日
737
738
  2018-01-08: 成人の日
738
739
  2018-02-11: 建国記念の日
739
740
  2018-02-12: 振替休日
740
- 2018-02-23: 天皇誕生日
741
741
  2018-03-21: 春分の日
742
742
  2018-04-29: 昭和の日
743
743
  2018-04-30: 振替休日
@@ -752,13 +752,16 @@
752
752
  2018-10-08: 体育の日
753
753
  2018-11-03: 文化の日
754
754
  2018-11-23: 勤労感謝の日
755
+ 2018-12-23: 天皇誕生日
755
756
  2018-12-24: 振替休日
756
757
  2019-01-01: 元日
757
758
  2019-01-14: 成人の日
758
759
  2019-02-11: 建国記念の日
759
- 2019-02-23: 天皇誕生日
760
760
  2019-03-21: 春分の日
761
761
  2019-04-29: 昭和の日
762
+ 2019-04-30: 国民の休日
763
+ 2019-05-01: 休日(祝日扱い)
764
+ 2019-05-02: 国民の休日
762
765
  2019-05-03: 憲法記念日
763
766
  2019-05-04: みどりの日
764
767
  2019-05-05: こどもの日
@@ -768,7 +771,8 @@
768
771
  2019-08-12: 振替休日
769
772
  2019-09-16: 敬老の日
770
773
  2019-09-23: 秋分の日
771
- 2019-10-14: 体育の日
774
+ 2019-10-14: 体育の日(スポーツの日)
775
+ 2019-10-22: 休日(祝日扱い)
772
776
  2019-11-03: 文化の日
773
777
  2019-11-04: 振替休日
774
778
  2019-11-23: 勤労感謝の日
@@ -776,17 +780,18 @@
776
780
  2020-01-13: 成人の日
777
781
  2020-02-11: 建国記念の日
778
782
  2020-02-23: 天皇誕生日
783
+ 2020-02-24: 振替休日
779
784
  2020-03-20: 春分の日
780
785
  2020-04-29: 昭和の日
781
786
  2020-05-03: 憲法記念日
782
787
  2020-05-04: みどりの日
783
788
  2020-05-05: こどもの日
784
789
  2020-05-06: 振替休日
785
- 2020-07-20: 海の日
786
- 2020-08-11: 山の日
790
+ 2020-07-23: 海の日
791
+ 2020-07-24: スポーツの日
792
+ 2020-08-10: 山の日
787
793
  2020-09-21: 敬老の日
788
794
  2020-09-22: 秋分の日
789
- 2020-10-12: 体育の日
790
795
  2020-11-03: 文化の日
791
796
  2020-11-23: 勤労感謝の日
792
797
  2021-01-01: 元日
@@ -798,11 +803,12 @@
798
803
  2021-05-03: 憲法記念日
799
804
  2021-05-04: みどりの日
800
805
  2021-05-05: こどもの日
801
- 2021-07-19: 海の日
802
- 2021-08-11: 山の日
806
+ 2021-07-22: 海の日
807
+ 2021-07-23: スポーツの日
808
+ 2021-08-08: 山の日
809
+ 2021-08-09: 振替休日
803
810
  2021-09-20: 敬老の日
804
811
  2021-09-23: 秋分の日
805
- 2021-10-11: 体育の日
806
812
  2021-11-03: 文化の日
807
813
  2021-11-23: 勤労感謝の日
808
814
  2022-01-01: 元日
@@ -818,7 +824,7 @@
818
824
  2022-08-11: 山の日
819
825
  2022-09-19: 敬老の日
820
826
  2022-09-23: 秋分の日
821
- 2022-10-10: 体育の日
827
+ 2022-10-10: スポーツの日
822
828
  2022-11-03: 文化の日
823
829
  2022-11-23: 勤労感謝の日
824
830
  2023-01-01: 元日
@@ -835,7 +841,7 @@
835
841
  2023-08-11: 山の日
836
842
  2023-09-18: 敬老の日
837
843
  2023-09-23: 秋分の日
838
- 2023-10-09: 体育の日
844
+ 2023-10-09: スポーツの日
839
845
  2023-11-03: 文化の日
840
846
  2023-11-23: 勤労感謝の日
841
847
  2024-01-01: 元日
@@ -855,7 +861,7 @@
855
861
  2024-09-16: 敬老の日
856
862
  2024-09-22: 秋分の日
857
863
  2024-09-23: 振替休日
858
- 2024-10-14: 体育の日
864
+ 2024-10-14: スポーツの日
859
865
  2024-11-03: 文化の日
860
866
  2024-11-04: 振替休日
861
867
  2024-11-23: 勤労感謝の日
@@ -863,6 +869,7 @@
863
869
  2025-01-13: 成人の日
864
870
  2025-02-11: 建国記念の日
865
871
  2025-02-23: 天皇誕生日
872
+ 2025-02-24: 振替休日
866
873
  2025-03-20: 春分の日
867
874
  2025-04-29: 昭和の日
868
875
  2025-05-03: 憲法記念日
@@ -873,7 +880,7 @@
873
880
  2025-08-11: 山の日
874
881
  2025-09-15: 敬老の日
875
882
  2025-09-23: 秋分の日
876
- 2025-10-13: 体育の日
883
+ 2025-10-13: スポーツの日
877
884
  2025-11-03: 文化の日
878
885
  2025-11-23: 勤労感謝の日
879
886
  2025-11-24: 振替休日
@@ -892,7 +899,7 @@
892
899
  2026-09-21: 敬老の日
893
900
  2026-09-22: 国民の休日
894
901
  2026-09-23: 秋分の日
895
- 2026-10-12: 体育の日
902
+ 2026-10-12: スポーツの日
896
903
  2026-11-03: 文化の日
897
904
  2026-11-23: 勤労感謝の日
898
905
  2027-01-01: 元日
@@ -909,7 +916,7 @@
909
916
  2027-08-11: 山の日
910
917
  2027-09-20: 敬老の日
911
918
  2027-09-23: 秋分の日
912
- 2027-10-11: 体育の日
919
+ 2027-10-11: スポーツの日
913
920
  2027-11-03: 文化の日
914
921
  2027-11-23: 勤労感謝の日
915
922
  2028-01-01: 元日
@@ -925,7 +932,7 @@
925
932
  2028-08-11: 山の日
926
933
  2028-09-18: 敬老の日
927
934
  2028-09-22: 秋分の日
928
- 2028-10-09: 体育の日
935
+ 2028-10-09: スポーツの日
929
936
  2028-11-03: 文化の日
930
937
  2028-11-23: 勤労感謝の日
931
938
  2029-01-01: 元日
@@ -944,10 +951,9 @@
944
951
  2029-09-17: 敬老の日
945
952
  2029-09-23: 秋分の日
946
953
  2029-09-24: 振替休日
947
- 2029-10-08: 体育の日
954
+ 2029-10-08: スポーツの日
948
955
  2029-11-03: 文化の日
949
956
  2029-11-23: 勤労感謝の日
950
- 2029-12-24: 振替休日
951
957
  2030-01-01: 元日
952
958
  2030-01-14: 成人の日
953
959
  2030-02-11: 建国記念の日
@@ -963,7 +969,7 @@
963
969
  2030-08-12: 振替休日
964
970
  2030-09-16: 敬老の日
965
971
  2030-09-23: 秋分の日
966
- 2030-10-14: 体育の日
972
+ 2030-10-14: スポーツの日
967
973
  2030-11-03: 文化の日
968
974
  2030-11-04: 振替休日
969
975
  2030-11-23: 勤労感謝の日
@@ -971,6 +977,7 @@
971
977
  2031-01-13: 成人の日
972
978
  2031-02-11: 建国記念の日
973
979
  2031-02-23: 天皇誕生日
980
+ 2031-02-24: 振替休日
974
981
  2031-03-21: 春分の日
975
982
  2031-04-29: 昭和の日
976
983
  2031-05-03: 憲法記念日
@@ -981,7 +988,7 @@
981
988
  2031-08-11: 山の日
982
989
  2031-09-15: 敬老の日
983
990
  2031-09-23: 秋分の日
984
- 2031-10-13: 体育の日
991
+ 2031-10-13: スポーツの日
985
992
  2031-11-03: 文化の日
986
993
  2031-11-23: 勤労感謝の日
987
994
  2031-11-24: 振替休日
@@ -999,7 +1006,7 @@
999
1006
  2032-09-20: 敬老の日
1000
1007
  2032-09-21: 国民の休日
1001
1008
  2032-09-22: 秋分の日
1002
- 2032-10-11: 体育の日
1009
+ 2032-10-11: スポーツの日
1003
1010
  2032-11-03: 文化の日
1004
1011
  2032-11-23: 勤労感謝の日
1005
1012
  2033-01-01: 元日
@@ -1016,7 +1023,7 @@
1016
1023
  2033-08-11: 山の日
1017
1024
  2033-09-19: 敬老の日
1018
1025
  2033-09-23: 秋分の日
1019
- 2033-10-10: 体育の日
1026
+ 2033-10-10: スポーツの日
1020
1027
  2033-11-03: 文化の日
1021
1028
  2033-11-23: 勤労感謝の日
1022
1029
  2034-01-01: 元日
@@ -1033,7 +1040,7 @@
1033
1040
  2034-08-11: 山の日
1034
1041
  2034-09-18: 敬老の日
1035
1042
  2034-09-23: 秋分の日
1036
- 2034-10-09: 体育の日
1043
+ 2034-10-09: スポーツの日
1037
1044
  2034-11-03: 文化の日
1038
1045
  2034-11-23: 勤労感謝の日
1039
1046
  2035-01-01: 元日
@@ -1052,10 +1059,9 @@
1052
1059
  2035-09-17: 敬老の日
1053
1060
  2035-09-23: 秋分の日
1054
1061
  2035-09-24: 振替休日
1055
- 2035-10-08: 体育の日
1062
+ 2035-10-08: スポーツの日
1056
1063
  2035-11-03: 文化の日
1057
1064
  2035-11-23: 勤労感謝の日
1058
- 2035-12-24: 振替休日
1059
1065
  2036-01-01: 元日
1060
1066
  2036-01-14: 成人の日
1061
1067
  2036-02-11: 建国記念の日
@@ -1070,7 +1076,7 @@
1070
1076
  2036-08-11: 山の日
1071
1077
  2036-09-15: 敬老の日
1072
1078
  2036-09-22: 秋分の日
1073
- 2036-10-13: 体育の日
1079
+ 2036-10-13: スポーツの日
1074
1080
  2036-11-03: 文化の日
1075
1081
  2036-11-23: 勤労感謝の日
1076
1082
  2036-11-24: 振替休日
@@ -1089,7 +1095,7 @@
1089
1095
  2037-09-21: 敬老の日
1090
1096
  2037-09-22: 国民の休日
1091
1097
  2037-09-23: 秋分の日
1092
- 2037-10-12: 体育の日
1098
+ 2037-10-12: スポーツの日
1093
1099
  2037-11-03: 文化の日
1094
1100
  2037-11-23: 勤労感謝の日
1095
1101
  2038-01-01: 元日
@@ -1105,7 +1111,7 @@
1105
1111
  2038-08-11: 山の日
1106
1112
  2038-09-20: 敬老の日
1107
1113
  2038-09-23: 秋分の日
1108
- 2038-10-11: 体育の日
1114
+ 2038-10-11: スポーツの日
1109
1115
  2038-11-03: 文化の日
1110
1116
  2038-11-23: 勤労感謝の日
1111
1117
  2039-01-01: 元日
@@ -1121,7 +1127,7 @@
1121
1127
  2039-08-11: 山の日
1122
1128
  2039-09-19: 敬老の日
1123
1129
  2039-09-23: 秋分の日
1124
- 2039-10-10: 体育の日
1130
+ 2039-10-10: スポーツの日
1125
1131
  2039-11-03: 文化の日
1126
1132
  2039-11-23: 勤労感謝の日
1127
1133
  2040-01-01: 元日
@@ -1139,10 +1145,9 @@
1139
1145
  2040-08-11: 山の日
1140
1146
  2040-09-17: 敬老の日
1141
1147
  2040-09-22: 秋分の日
1142
- 2040-10-08: 体育の日
1148
+ 2040-10-08: スポーツの日
1143
1149
  2040-11-03: 文化の日
1144
1150
  2040-11-23: 勤労感謝の日
1145
- 2040-12-24: 振替休日
1146
1151
  2041-01-01: 元日
1147
1152
  2041-01-14: 成人の日
1148
1153
  2041-02-11: 建国記念の日
@@ -1158,7 +1163,7 @@
1158
1163
  2041-08-12: 振替休日
1159
1164
  2041-09-16: 敬老の日
1160
1165
  2041-09-23: 秋分の日
1161
- 2041-10-14: 体育の日
1166
+ 2041-10-14: スポーツの日
1162
1167
  2041-11-03: 文化の日
1163
1168
  2041-11-04: 振替休日
1164
1169
  2041-11-23: 勤労感謝の日
@@ -1166,6 +1171,7 @@
1166
1171
  2042-01-13: 成人の日
1167
1172
  2042-02-11: 建国記念の日
1168
1173
  2042-02-23: 天皇誕生日
1174
+ 2042-02-24: 振替休日
1169
1175
  2042-03-20: 春分の日
1170
1176
  2042-04-29: 昭和の日
1171
1177
  2042-05-03: 憲法記念日
@@ -1176,7 +1182,7 @@
1176
1182
  2042-08-11: 山の日
1177
1183
  2042-09-15: 敬老の日
1178
1184
  2042-09-23: 秋分の日
1179
- 2042-10-13: 体育の日
1185
+ 2042-10-13: スポーツの日
1180
1186
  2042-11-03: 文化の日
1181
1187
  2042-11-23: 勤労感謝の日
1182
1188
  2042-11-24: 振替休日
@@ -1195,7 +1201,7 @@
1195
1201
  2043-09-21: 敬老の日
1196
1202
  2043-09-22: 国民の休日
1197
1203
  2043-09-23: 秋分の日
1198
- 2043-10-12: 体育の日
1204
+ 2043-10-12: スポーツの日
1199
1205
  2043-11-03: 文化の日
1200
1206
  2043-11-23: 勤労感謝の日
1201
1207
  2044-01-01: 元日
@@ -1212,7 +1218,7 @@
1212
1218
  2044-08-11: 山の日
1213
1219
  2044-09-19: 敬老の日
1214
1220
  2044-09-22: 秋分の日
1215
- 2044-10-10: 体育の日
1221
+ 2044-10-10: スポーツの日
1216
1222
  2044-11-03: 文化の日
1217
1223
  2044-11-23: 勤労感謝の日
1218
1224
  2045-01-01: 元日
@@ -1229,7 +1235,7 @@
1229
1235
  2045-08-11: 山の日
1230
1236
  2045-09-18: 敬老の日
1231
1237
  2045-09-22: 秋分の日
1232
- 2045-10-09: 体育の日
1238
+ 2045-10-09: スポーツの日
1233
1239
  2045-11-03: 文化の日
1234
1240
  2045-11-23: 勤労感謝の日
1235
1241
  2046-01-01: 元日
@@ -1248,10 +1254,9 @@
1248
1254
  2046-09-17: 敬老の日
1249
1255
  2046-09-23: 秋分の日
1250
1256
  2046-09-24: 振替休日
1251
- 2046-10-08: 体育の日
1257
+ 2046-10-08: スポーツの日
1252
1258
  2046-11-03: 文化の日
1253
1259
  2046-11-23: 勤労感謝の日
1254
- 2046-12-24: 振替休日
1255
1260
  2047-01-01: 元日
1256
1261
  2047-01-14: 成人の日
1257
1262
  2047-02-11: 建国記念の日
@@ -1267,7 +1272,7 @@
1267
1272
  2047-08-12: 振替休日
1268
1273
  2047-09-16: 敬老の日
1269
1274
  2047-09-23: 秋分の日
1270
- 2047-10-14: 体育の日
1275
+ 2047-10-14: スポーツの日
1271
1276
  2047-11-03: 文化の日
1272
1277
  2047-11-04: 振替休日
1273
1278
  2047-11-23: 勤労感謝の日
@@ -1275,6 +1280,7 @@
1275
1280
  2048-01-13: 成人の日
1276
1281
  2048-02-11: 建国記念の日
1277
1282
  2048-02-23: 天皇誕生日
1283
+ 2048-02-24: 振替休日
1278
1284
  2048-03-20: 春分の日
1279
1285
  2048-04-29: 昭和の日
1280
1286
  2048-05-03: 憲法記念日
@@ -1285,7 +1291,7 @@
1285
1291
  2048-08-11: 山の日
1286
1292
  2048-09-21: 敬老の日
1287
1293
  2048-09-22: 秋分の日
1288
- 2048-10-12: 体育の日
1294
+ 2048-10-12: スポーツの日
1289
1295
  2048-11-03: 文化の日
1290
1296
  2048-11-23: 勤労感謝の日
1291
1297
  2049-01-01: 元日
@@ -1302,7 +1308,7 @@
1302
1308
  2049-09-20: 敬老の日
1303
1309
  2049-09-21: 国民の休日
1304
1310
  2049-09-22: 秋分の日
1305
- 2049-10-11: 体育の日
1311
+ 2049-10-11: スポーツの日
1306
1312
  2049-11-03: 文化の日
1307
1313
  2049-11-23: 勤労感謝の日
1308
1314
  2050-01-01: 元日
@@ -1319,6 +1325,6 @@
1319
1325
  2050-08-11: 山の日
1320
1326
  2050-09-19: 敬老の日
1321
1327
  2050-09-23: 秋分の日
1322
- 2050-10-10: 体育の日
1328
+ 2050-10-10: スポーツの日
1323
1329
  2050-11-03: 文化の日
1324
1330
  2050-11-23: 勤労感謝の日
@@ -1,6 +1,5 @@
1
- # -*- coding: utf-8 -*-
2
- require 'holiday_jp/holiday'
3
- require 'holiday_jp/holidays'
1
+ require "holiday_jp/holiday"
2
+ require "holiday_jp/holidays"
4
3
 
5
4
  module HolidayJp
6
5
  def self.between(start, last)
@@ -11,8 +10,6 @@ module HolidayJp
11
10
  holidays.holiday?(date)
12
11
  end
13
12
 
14
- private
15
-
16
13
  def self.holidays
17
14
  @@_holidays ||= Holidays.new
18
15
  end
@@ -1,31 +1,33 @@
1
1
  # -*- coding: utf-8 -*-
2
- require 'date'
2
+ require "date"
3
+
3
4
  module HolidayJp
4
5
  class Holiday
5
6
  WDAY_NAMES = %w(日 月 火 水 木 金 土)
6
7
 
7
8
  EN_HOLIDAY_NAMES = {
8
- '元日' => "New Year's Day",
9
- '成人の日' => 'Coming of Age Day',
10
- '建国記念の日' => 'National Foundation Day',
11
- '春分の日' => 'Vernal Equinox Day',
12
- '憲法記念日' => 'Constitution Memorial Day',
13
- 'みどりの日' => 'Greenery Day',
14
- 'こどもの日' => "Children's Day",
15
- '海の日' => 'Marine Day',
16
- '山の日' => 'Mountain Day',
17
- '敬老の日' => 'Respect for the Aged Day',
18
- '秋分の日' => 'Autumnal Equinox Day',
19
- '体育の日' => 'Health and Sports Day',
20
- '文化の日' => 'National Culture Day',
21
- '勤労感謝の日' => 'Labor Thanksgiving Day',
22
- '天皇誕生日' => "Emperor's Birthday",
23
- '昭和の日' => 'Showa Day',
24
- '振替休日' => 'Holiday in lieu',
25
- '国民の休日' => "Citizen's Holiday",
26
- '即位礼正殿の儀' => 'The Ceremony of the Enthronement of His Majesty th Emperor (at the Seiden)',
27
- '昭和天皇の大喪の礼' => 'The Funeral Ceremony of Emperor Showa.',
28
- '皇太子徳仁親王の結婚の儀' => 'The Rite of Wedding of HIH Crown Prince Naruhito'
9
+ "元日" => "New Year's Day",
10
+ "成人の日" => "Coming of Age Day",
11
+ "建国記念の日" => "National Foundation Day",
12
+ "春分の日" => "Vernal Equinox Day",
13
+ "憲法記念日" => "Constitution Memorial Day",
14
+ "みどりの日" => "Greenery Day",
15
+ "こどもの日" => "Children's Day",
16
+ "海の日" => "Marine Day",
17
+ "山の日" => "Mountain Day",
18
+ "敬老の日" => "Respect for the Aged Day",
19
+ "秋分の日" => "Autumnal Equinox Day",
20
+ "体育の日" => "Health and Sports Day",
21
+ "スポーツの日" => "Sports Day",
22
+ "文化の日" => "National Culture Day",
23
+ "勤労感謝の日" => "Labor Thanksgiving Day",
24
+ "天皇誕生日" => "Emperor's Birthday",
25
+ "昭和の日" => "Showa Day",
26
+ "振替休日" => "Holiday in lieu",
27
+ "国民の休日" => "Citizen's Holiday",
28
+ "即位礼正殿の儀" => "The Ceremony of the Enthronement of His Majesty th Emperor (at the Seiden)",
29
+ "昭和天皇の大喪の礼" => "The Funeral Ceremony of Emperor Showa.",
30
+ "皇太子徳仁親王の結婚の儀" => "The Rite of Wedding of HIH Crown Prince Naruhito"
29
31
  }
30
32
 
31
33
  attr_reader :date, :name
@@ -1,5 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- require 'yaml'
1
+ require "yaml"
3
2
 
4
3
  module HolidayJp
5
4
  class Holidays
@@ -7,7 +6,7 @@ module HolidayJp
7
6
 
8
7
  def initialize
9
8
  @holidays = {}
10
- yaml = YAML.load_file(File.expand_path('../../../holidays.yml', __FILE__))
9
+ yaml = YAML.load_file(File.expand_path("../../../holidays.yml", __FILE__))
11
10
  yaml.map do |key, value|
12
11
  @holidays[key] = Holiday.new(key, value)
13
12
  end
@@ -15,12 +14,12 @@ module HolidayJp
15
14
 
16
15
  def between(start, last)
17
16
  holidays.find_all do |date, _holiday|
18
- start <= date && date <= last
17
+ start.to_date <= date && date <= last.to_date
19
18
  end.map(&:last)
20
19
  end
21
20
 
22
21
  def holiday?(date)
23
- holidays[date]
22
+ holidays.has_key?(date.to_date)
24
23
  end
25
24
  end
26
25
  end
@@ -1,3 +1,3 @@
1
1
  module HolidayJp
2
- VERSION = '0.5.0'
2
+ VERSION = "0.8.0"
3
3
  end
@@ -19,29 +19,64 @@ class TestHolidayJp < Test::Unit::TestCase
19
19
  assert_equal holidays[2].date, Date.new(2009, 1, 12)
20
20
  end
21
21
 
22
+ def test_between_accepts_datetime
23
+ holidays = HolidayJp.between(DateTime.new(2008, 12, 23), DateTime.new(2009, 1, 12))
24
+ assert_equal holidays[0].date, Date.new(2008, 12, 23)
25
+ assert_equal holidays[1].date, Date.new(2009, 1, 1)
26
+ assert_equal holidays[2].date, Date.new(2009, 1, 12)
27
+ end
28
+
29
+ def test_between_accepts_time
30
+ holidays = HolidayJp.between(Time.new(2008, 12, 23), Time.new(2009, 1, 12))
31
+ assert_equal holidays[0].date, Date.new(2008, 12, 23)
32
+ assert_equal holidays[1].date, Date.new(2009, 1, 1)
33
+ assert_equal holidays[2].date, Date.new(2009, 1, 12)
34
+ end
35
+
22
36
  def test_holiday?
23
- assert HolidayJp.holiday?(Date.new(2011, 9, 19))
24
- assert !HolidayJp.holiday?(Date.new(2011, 9, 18))
37
+ assert_true HolidayJp.holiday?(Date.new(2011, 9, 19))
38
+ assert_false HolidayJp.holiday?(Date.new(2011, 9, 18))
39
+ end
40
+
41
+ def test_holiday_p_accepts_datetime
42
+ assert_true HolidayJp.holiday?(DateTime.new(2011, 9, 19))
43
+ assert_false HolidayJp.holiday?(DateTime.new(2011, 9, 18))
44
+ end
45
+
46
+ def test_holiday_p_accepts_time
47
+ assert_true HolidayJp.holiday?(Time.new(2011, 9, 19))
48
+ assert_false HolidayJp.holiday?(Time.new(2011, 9, 18))
25
49
  end
26
50
 
27
51
  def test_mountain_day_from_2016
28
- assert !HolidayJp.holiday?(Date.new(2015, 8, 11))
52
+ assert_false HolidayJp.holiday?(Date.new(2015, 8, 11))
29
53
  (2016..2050).each do |year|
30
- assert HolidayJp.holiday?(Date.new(year, 8, 11))
54
+ next if year == 2020 || year == 2021 # Tokyo Olympic year
55
+ assert_true HolidayJp.holiday?(Date.new(year, 8, 11))
31
56
  end
32
57
  end
33
58
 
34
59
  def test_emperors_birthday
35
60
  1970.upto(1988) do |year|
36
- assert HolidayJp.holiday?(Date.new(year, 4, 29))
61
+ assert_true HolidayJp.holiday?(Date.new(year, 4, 29))
37
62
  end
38
63
 
39
- 1989.upto(2016) do |year|
64
+ 1989.upto(2018) do |year|
40
65
  assert HolidayJp.holiday?(Date.new(year, 12, 23))
41
66
  end
42
67
 
43
- 2017.upto(2050) do |year|
68
+ assert !HolidayJp.holiday?(Date.new(2019, 2, 23))
69
+ assert !HolidayJp.holiday?(Date.new(2019, 12, 23))
70
+
71
+ 2020.upto(2050) do |year|
44
72
  assert HolidayJp.holiday?(Date.new(year, 2, 23))
45
73
  end
46
74
  end
75
+
76
+ def test_emperors_enthronement
77
+ assert HolidayJp.holiday?(Date.new(2019, 4, 30))
78
+ assert HolidayJp.holiday?(Date.new(2019, 5, 1))
79
+ assert HolidayJp.holiday?(Date.new(2019, 5, 2))
80
+ assert HolidayJp.holiday?(Date.new(2019, 10, 22))
81
+ end
47
82
  end
@@ -0,0 +1,21 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'test/unit'
3
+ require 'net/http'
4
+ require 'yaml'
5
+
6
+ class TestHolidayJpYaml < Test::Unit::TestCase
7
+ def test_yaml
8
+ yaml = YAML.load_file(File.expand_path('../../holidays.yml', __FILE__))
9
+ uri = URI.parse('https://raw.githubusercontent.com/holiday-jp/holiday_jp/v0.x/holidays.yml')
10
+ http = Net::HTTP.new(uri.host, uri.port)
11
+ http.use_ssl = true
12
+ holiday_jp_yaml = YAML.load(http.get(uri.request_uri).body)
13
+ yaml.map do |date, name|
14
+ assert_equal holiday_jp_yaml[date], name
15
+ end
16
+ holiday_jp_yaml.map do |date, name|
17
+ assert_equal yaml[date], name
18
+ end
19
+ assert_equal yaml.length, holiday_jp_yaml.length
20
+ end
21
+ end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: holiday_jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaki Komagata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-09 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - "<"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '3.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - "<"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -61,8 +61,9 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - ".document"
63
63
  - ".gemtest"
64
+ - ".github/workflows/ci.yml"
64
65
  - ".gitignore"
65
- - ".travis.yml"
66
+ - ".gitmodules"
66
67
  - CHANGELOG.md
67
68
  - Gemfile
68
69
  - LICENSE
@@ -76,6 +77,7 @@ files:
76
77
  - lib/holiday_jp/holidays.rb
77
78
  - lib/holiday_jp/version.rb
78
79
  - test/test_holiday_jp.rb
80
+ - test/test_holiday_jp_yaml.rb
79
81
  homepage: http://github.com/komagata/holiday_jp
80
82
  licenses: []
81
83
  metadata: {}
@@ -94,10 +96,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
96
  - !ruby/object:Gem::Version
95
97
  version: '0'
96
98
  requirements: []
97
- rubyforge_project: holiday_jp
98
- rubygems_version: 2.5.1
99
+ rubygems_version: 3.0.3
99
100
  signing_key:
100
101
  specification_version: 4
101
102
  summary: Japanese Holidays.
102
103
  test_files:
103
104
  - test/test_holiday_jp.rb
105
+ - test/test_holiday_jp_yaml.rb
@@ -1,11 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.9.3
4
- - 2.1.5
5
- - 2.2.2
6
- - 2.2.3
7
- - 2.2.5
8
- - 2.3.1
9
- before_install:
10
- - sudo apt-get update
11
- - gem update bundler