holiday_jp 0.1.0 → 0.2.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.
- data/.document +0 -0
- data/README.rdoc +3 -1
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/holiday_jp.gemspec +54 -0
- data/lib/holiday_jp.rb +10 -2
- data/test/helper.rb +0 -0
- data/test/test_holiday_jp.rb +5 -5
- metadata +30 -11
data/.document
CHANGED
File without changes
|
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ begin
|
|
10
10
|
gem.email = "komagata@gmail.com"
|
11
11
|
gem.homepage = "http://github.com/komagata/holiday_jp"
|
12
12
|
gem.authors = ["Masaki KOMAGATA"]
|
13
|
-
gem.add_development_dependency "
|
13
|
+
gem.add_development_dependency "shoulda", ">= 2.11.3"
|
14
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
15
|
end
|
16
16
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/holiday_jp.gemspec
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{holiday_jp}
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Masaki KOMAGATA"]
|
12
|
+
s.date = %q{2010-09-14}
|
13
|
+
s.description = %q{Japanese Holidays from 1970 to 2050.}
|
14
|
+
s.email = %q{komagata@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"holiday_jp.gemspec",
|
27
|
+
"lib/holiday_jp.rb",
|
28
|
+
"test/helper.rb",
|
29
|
+
"test/test_holiday_jp.rb"
|
30
|
+
]
|
31
|
+
s.homepage = %q{http://github.com/komagata/holiday_jp}
|
32
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
s.rubygems_version = %q{1.3.7}
|
35
|
+
s.summary = %q{Japanese Holidays.}
|
36
|
+
s.test_files = [
|
37
|
+
"test/helper.rb",
|
38
|
+
"test/test_holiday_jp.rb"
|
39
|
+
]
|
40
|
+
|
41
|
+
if s.respond_to? :specification_version then
|
42
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
43
|
+
s.specification_version = 3
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_development_dependency(%q<shoulda>, [">= 2.11.3"])
|
47
|
+
else
|
48
|
+
s.add_dependency(%q<shoulda>, [">= 2.11.3"])
|
49
|
+
end
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<shoulda>, [">= 2.11.3"])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
data/lib/holiday_jp.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'date'
|
2
|
+
require 'ostruct'
|
2
3
|
|
3
4
|
class HolidayJp
|
4
5
|
HOLIDAYS = [
|
@@ -7707,12 +7708,19 @@ class HolidayJp
|
|
7707
7708
|
:week => "金"
|
7708
7709
|
},
|
7709
7710
|
]
|
7710
|
-
|
7711
|
+
|
7711
7712
|
DAYNAMES_JA = %w(日 月 火 水 木 金 土)
|
7712
7713
|
|
7714
|
+
# == Between date
|
7715
|
+
# === Example:
|
7716
|
+
# >> holidays = HolidayJp.between(Date.new(2010, 9, 14), Date.new(2010, 9, 21))
|
7717
|
+
# >> holidays.first.name # 敬老の日
|
7718
|
+
# === parameters
|
7719
|
+
# * <tt>start</tt>
|
7720
|
+
# * <tt>last</tt>
|
7713
7721
|
def self.between(start, last)
|
7714
7722
|
HOLIDAYS.map do |hd|
|
7715
|
-
start <= hd[:date] && hd[:date] <= last ? hd : nil
|
7723
|
+
start <= hd[:date] && hd[:date] <= last ? OpenStruct.new(hd) : nil
|
7716
7724
|
end.compact
|
7717
7725
|
end
|
7718
7726
|
end
|
data/test/helper.rb
CHANGED
File without changes
|
data/test/test_holiday_jp.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
class TestHolidayJp < Test::Unit::TestCase
|
4
|
-
should
|
4
|
+
should '#between return correct holidays' do
|
5
5
|
holidays = HolidayJp.between(Date.new(2009, 1, 1), Date.new(2009, 1, 31))
|
6
|
-
assert_equal holidays[0]
|
7
|
-
assert_equal holidays[0]
|
8
|
-
assert_equal holidays[1]
|
9
|
-
assert_equal holidays[1]
|
6
|
+
assert_equal holidays[0].date, Date.new(2009, 1, 1)
|
7
|
+
assert_equal holidays[0].name, '元日'
|
8
|
+
assert_equal holidays[1].date, Date.new(2009, 1, 12)
|
9
|
+
assert_equal holidays[1].name, '成人の日'
|
10
10
|
end
|
11
11
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: holiday_jp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Masaki KOMAGATA
|
@@ -9,19 +15,25 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-09-14 00:00:00 +09:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
name: shoulda
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
29
|
+
hash: 37
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 11
|
33
|
+
- 3
|
34
|
+
version: 2.11.3
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
25
37
|
description: Japanese Holidays from 1970 to 2050.
|
26
38
|
email: komagata@gmail.com
|
27
39
|
executables: []
|
@@ -38,6 +50,7 @@ files:
|
|
38
50
|
- README.rdoc
|
39
51
|
- Rakefile
|
40
52
|
- VERSION
|
53
|
+
- holiday_jp.gemspec
|
41
54
|
- lib/holiday_jp.rb
|
42
55
|
- test/helper.rb
|
43
56
|
- test/test_holiday_jp.rb
|
@@ -51,21 +64,27 @@ rdoc_options:
|
|
51
64
|
require_paths:
|
52
65
|
- lib
|
53
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
54
68
|
requirements:
|
55
69
|
- - ">="
|
56
70
|
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
57
74
|
version: "0"
|
58
|
-
version:
|
59
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
60
77
|
requirements:
|
61
78
|
- - ">="
|
62
79
|
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
63
83
|
version: "0"
|
64
|
-
version:
|
65
84
|
requirements: []
|
66
85
|
|
67
86
|
rubyforge_project:
|
68
|
-
rubygems_version: 1.3.
|
87
|
+
rubygems_version: 1.3.7
|
69
88
|
signing_key:
|
70
89
|
specification_version: 3
|
71
90
|
summary: Japanese Holidays.
|