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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75733a063bfa45b031cb02aecb0feca3aae51353
4
- data.tar.gz: 450bcf60941a2bed933d467783c7ea2e13d79ea2
3
+ metadata.gz: 85b576c3baeda52e82aa1f40a434ae3dd3038cb7
4
+ data.tar.gz: 651c0f30c625996c7c39478a3693441ffcc307a7
5
5
  SHA512:
6
- metadata.gz: 603df314169f0f9b4f96ce1c362f6c552dbbf2d7ef7a4f3a0ba3b9f3d61a7572243a806de037a436a43f16d11416b0e7c058af2597f499c4ec040d3416e2fe4d
7
- data.tar.gz: d02f182411fcd0233609d5f78a27bdeca2c084971b702a4b192143625bdf11aae741131f2f2298ed8151db8bffa5d61946f3ad83f92b6c89727eb128d5492735
6
+ metadata.gz: 51fc2ed4dfbed0d8e4e35528636721e14c5a1de16d27b3fbe378557b1d2c0be9853d88cb217011626d7084ae1a7ef975e72e65d7c83e6d58876f6fb3ad2b3426
7
+ data.tar.gz: b8c9c54c313593aab6f445f5f417b0997fee96a6ec2fd7c4505b8a797edf2d453c75d850899147bbccac3092adeeceabd70e437bb053a87e573e8a27675fe68f
@@ -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.2"
6
+ VERSION = "1.0.3"
7
7
 
8
- if !const_defined?("DATA")
9
- Week1 = 1..7
10
- Week2 = 8..14
11
- Week3 = 15..21
12
- Week4 = 22..28
13
- Sun,Mon,Tue,Wed,Thu,Fru,Sat = (0..6).to_a
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
- # 祝日データ: 1948年7月20日以降で有効
17
- DATA = [
18
- ["元日", 1949..Inf , 1, 1 ],
19
- ["成人の日", 1949..1999, 1, 15 ],
20
- ["成人の日", 2000..Inf , 1, Week2, Mon ],
21
- ["建国記念の日",1967..Inf , 2, 11 ],
22
- ["天皇誕生日", 1949..1988, 4, 29 ],
23
- ["みどりの日", 1989..2006, 4, 29 ],
24
- ["昭和の日", 2007..Inf , 4, 29 ],
25
- ["憲法記念日", 1949..Inf , 5, 3 ],
26
- ["みどりの日", 2007..Inf , 5, 4 ],
27
- ["こどもの日", 1949..Inf , 5, 5 ],
28
- ["海の日", 1996..2002, 7, 20 ],
29
- ["海の日", 2003..Inf , 7, Week3, Mon ],
30
- ["敬老の日", 1966..2002, 9, 15 ],
31
- ["敬老の日", 2003..Inf , 9, Week3, Mon ],
32
- ["体育の日", 1966..1999, 10, 10 ],
33
- ["体育の日", 2000..Inf , 10, Week2, Mon ],
34
- ["文化の日", 1948..Inf , 11, 3 ],
35
- ["勤労感謝の日",1948..Inf , 11, 23 ],
36
- ["天皇誕生日", 1989..Inf , 12, 23 ],
37
- ["春分の日", 1949..1979, 3,
38
- proc{|y|Integer(20.8357+0.242194*(y-1980))-Integer((y-1983)/4.0)} ],
39
- ["春分の日", 1980..2099, 3,
40
- proc{|y|Integer(20.8431+0.242194*(y-1980))-Integer((y-1980)/4.0)} ],
41
- ["秋分の日" , 1948..1979, 9,
42
- proc{|y|Integer(23.2588+0.242194*(y-1980))-Integer((y-1983)/4.0)} ],
43
- ["秋分の日" , 1980..2099, 9,
44
- proc{|y|Integer(23.2488+0.242194*(y-1980))-Integer((y-1980)/4.0)} ],
45
- ["皇太子明仁親王の結婚の儀", 1959..1959, 4, 10 ],
46
- ["昭和天皇の大喪の礼", 1989..1989, 2, 24 ],
47
- ["即位礼正殿の儀", 1990..1990, 11, 12 ],
48
- ["皇太子徳仁親王の結婚の儀", 1993..1993, 6, 9 ]
49
- ]
50
- DATA.each{|x| x[0].freeze; x.freeze }
51
- DATA.freeze
52
- TABLE = {}
53
- FURIKAE_START = Date.new(1973,4,12).freeze
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==Sun
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==Sun and d>=FURIKAE_START
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!=Sat
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.2
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-07-11 00:00:00.000000000 Z
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: []