holiday_japan 1.0.2 → 1.0.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 +4 -4
- data/holiday_japan.gemspec +1 -0
- data/lib/holiday_japan.rb +48 -50
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 85b576c3baeda52e82aa1f40a434ae3dd3038cb7
|
|
4
|
+
data.tar.gz: 651c0f30c625996c7c39478a3693441ffcc307a7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 51fc2ed4dfbed0d8e4e35528636721e14c5a1de16d27b3fbe378557b1d2c0be9853d88cb217011626d7084ae1a7ef975e72e65d7c83e6d58876f6fb3ad2b3426
|
|
7
|
+
data.tar.gz: b8c9c54c313593aab6f445f5f417b0997fee96a6ec2fd7c4505b8a797edf2d453c75d850899147bbccac3092adeeceabd70e437bb053a87e573e8a27675fe68f
|
data/holiday_japan.gemspec
CHANGED
|
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
|
|
|
11
11
|
gem.description = %q{Calculate National Holidays of Japan}
|
|
12
12
|
gem.summary = %q{Calculate National Holidays of Japan}
|
|
13
13
|
gem.homepage = "https://github.com/masa16/holiday_japan"
|
|
14
|
+
gem.license = "MIT"
|
|
14
15
|
|
|
15
16
|
gem.files = `git ls-files`.split($/)
|
|
16
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/holiday_japan.rb
CHANGED
|
@@ -3,55 +3,53 @@ require "date"
|
|
|
3
3
|
|
|
4
4
|
module HolidayJapan
|
|
5
5
|
|
|
6
|
-
VERSION = "1.0.
|
|
6
|
+
VERSION = "1.0.3"
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Inf = 1.0/0.0
|
|
8
|
+
WEEK1 = 1..7
|
|
9
|
+
WEEK2 = 8..14
|
|
10
|
+
WEEK3 = 15..21
|
|
11
|
+
WEEK4 = 22..28
|
|
12
|
+
SUN,MON,TUE,WED,THU,FRU,SAT = (0..6).to_a
|
|
13
|
+
INF = 1.0/0.0
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
end
|
|
15
|
+
# 祝日データ: 1948年7月20日以降で有効
|
|
16
|
+
DATA = [
|
|
17
|
+
["元日", 1949..INF , 1, 1 ],
|
|
18
|
+
["成人の日", 1949..1999, 1, 15 ],
|
|
19
|
+
["成人の日", 2000..INF , 1, WEEK2, MON ],
|
|
20
|
+
["建国記念の日",1967..INF , 2, 11 ],
|
|
21
|
+
["天皇誕生日", 1949..1988, 4, 29 ],
|
|
22
|
+
["みどりの日", 1989..2006, 4, 29 ],
|
|
23
|
+
["昭和の日", 2007..INF , 4, 29 ],
|
|
24
|
+
["憲法記念日", 1949..INF , 5, 3 ],
|
|
25
|
+
["みどりの日", 2007..INF , 5, 4 ],
|
|
26
|
+
["こどもの日", 1949..INF , 5, 5 ],
|
|
27
|
+
["海の日", 1996..2002, 7, 20 ],
|
|
28
|
+
["海の日", 2003..INF , 7, WEEK3, MON ],
|
|
29
|
+
["敬老の日", 1966..2002, 9, 15 ],
|
|
30
|
+
["敬老の日", 2003..INF , 9, WEEK3, MON ],
|
|
31
|
+
["体育の日", 1966..1999, 10, 10 ],
|
|
32
|
+
["体育の日", 2000..INF , 10, WEEK2, MON ],
|
|
33
|
+
["文化の日", 1948..INF , 11, 3 ],
|
|
34
|
+
["勤労感謝の日",1948..INF , 11, 23 ],
|
|
35
|
+
["天皇誕生日", 1989..INF , 12, 23 ],
|
|
36
|
+
["春分の日", 1949..1979, 3,
|
|
37
|
+
proc{|y|Integer(20.8357+0.242194*(y-1980))-Integer((y-1983)/4.0)} ],
|
|
38
|
+
["春分の日", 1980..2099, 3,
|
|
39
|
+
proc{|y|Integer(20.8431+0.242194*(y-1980))-Integer((y-1980)/4.0)} ],
|
|
40
|
+
["秋分の日" , 1948..1979, 9,
|
|
41
|
+
proc{|y|Integer(23.2588+0.242194*(y-1980))-Integer((y-1983)/4.0)} ],
|
|
42
|
+
["秋分の日" , 1980..2099, 9,
|
|
43
|
+
proc{|y|Integer(23.2488+0.242194*(y-1980))-Integer((y-1980)/4.0)} ],
|
|
44
|
+
["皇太子明仁親王の結婚の儀", 1959..1959, 4, 10 ],
|
|
45
|
+
["昭和天皇の大喪の礼", 1989..1989, 2, 24 ],
|
|
46
|
+
["即位礼正殿の儀", 1990..1990, 11, 12 ],
|
|
47
|
+
["皇太子徳仁親王の結婚の儀", 1993..1993, 6, 9 ]
|
|
48
|
+
]
|
|
49
|
+
DATA.each{|x| x[0].freeze; x.freeze }
|
|
50
|
+
DATA.freeze
|
|
51
|
+
TABLE = {}
|
|
52
|
+
FURIKAE_START = Date.new(1973,4,12).freeze
|
|
55
53
|
|
|
56
54
|
module_function
|
|
57
55
|
|
|
@@ -83,14 +81,14 @@ module HolidayJapan
|
|
|
83
81
|
# compensating holiday
|
|
84
82
|
if y >= 2007
|
|
85
83
|
a.each do |d|
|
|
86
|
-
if d.wday==
|
|
84
|
+
if d.wday==SUN
|
|
87
85
|
d+=1 while h[d]
|
|
88
86
|
h[d] = "振替休日"
|
|
89
87
|
end
|
|
90
88
|
end
|
|
91
89
|
elsif y >= 1973
|
|
92
90
|
a.each do |d|
|
|
93
|
-
if d.wday==
|
|
91
|
+
if d.wday==SUN and d>=FURIKAE_START
|
|
94
92
|
h[d+1] = "振替休日"
|
|
95
93
|
end
|
|
96
94
|
end
|
|
@@ -98,7 +96,7 @@ module HolidayJapan
|
|
|
98
96
|
# consecutive holiday
|
|
99
97
|
if y >= 1986
|
|
100
98
|
a.each do |d|
|
|
101
|
-
if h[d+2] and !h[d+1] and d.wday!=
|
|
99
|
+
if h[d+2] and !h[d+1] and d.wday!=SAT
|
|
102
100
|
h[d+1] = "国民の休日"
|
|
103
101
|
end
|
|
104
102
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: holiday_japan
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masahiro TANAKA
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-10-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Calculate National Holidays of Japan
|
|
14
14
|
email:
|
|
@@ -25,7 +25,8 @@ files:
|
|
|
25
25
|
- holiday_japan.gemspec
|
|
26
26
|
- lib/holiday_japan.rb
|
|
27
27
|
homepage: https://github.com/masa16/holiday_japan
|
|
28
|
-
licenses:
|
|
28
|
+
licenses:
|
|
29
|
+
- MIT
|
|
29
30
|
metadata: {}
|
|
30
31
|
post_install_message:
|
|
31
32
|
rdoc_options: []
|