era_ja 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Guardfile +1 -1
- data/README.ja.md +5 -1
- data/README.md +5 -1
- data/era_ja.gemspec +3 -3
- data/lib/era_ja.rb +1 -1
- data/lib/era_ja/version.rb +1 -1
- data/spec/date_spec.rb +2 -2
- data/spec/spec_helper.rb +7 -0
- data/spec/time_spec.rb +2 -2
- metadata +11 -11
data/Guardfile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# A sample Guardfile
|
3
3
|
# More info at https://github.com/guard/guard#readme
|
4
4
|
|
5
|
-
guard 'rspec', :
|
5
|
+
guard 'rspec', :cmd => 'rspec --color --format progress', :all_after_pass => false do
|
6
6
|
watch(%r{^spec/.+_spec\.rb$})
|
7
7
|
watch(%r{^lib/era_ja/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
8
8
|
watch('lib/era_ja.rb') { "spec" }
|
data/README.ja.md
CHANGED
@@ -16,6 +16,10 @@
|
|
16
16
|
|
17
17
|
$ gem install era_ja
|
18
18
|
|
19
|
+
### ruby version ###
|
20
|
+
|
21
|
+
era_jaはruby1.9.3とruby2.0.0でテストをしています。
|
22
|
+
|
19
23
|
## Usage
|
20
24
|
|
21
25
|
### フォーマット文字列
|
@@ -70,7 +74,7 @@ EraJa#to_eraメソッドでの追加のフォーマット文字列は以下の
|
|
70
74
|
|
71
75
|
元号については以下の問題点があります。
|
72
76
|
|
73
|
-
* 明治の開始を
|
77
|
+
* 明治の開始を1868年9月8日としていますが旧暦での日付です。
|
74
78
|
* 大正、昭和の開始日はそれぞれ明治、大正の最終日と同日です。
|
75
79
|
* [昭和ト改元](http://ja.wikisource.org/wiki/%e6%98%ad%e5%92%8c%e3%83%88%e6%94%b9%e5%85%83)
|
76
80
|
* [大正十五年十二月ニ十五日以後ヲ改メテ昭和元年ト爲ス](http://ja.wikisource.org/wiki/%e5%a4%a7%e6%ad%a3%e5%8d%81%e4%ba%94%e5%b9%b4%e5%8d%81%e4%ba%8c%e6%9c%88%e3%83%8b%e5%8d%81%e4%ba%94%e6%97%a5%e4%bb%a5%e5%be%8c%e3%83%b2%e6%94%b9%e3%83%a1%e3%83%86%e6%98%ad%e5%92%8c%e5%85%83%e5%b9%b4%e3%83%88%e7%88%b2%e3%82%b9)
|
data/README.md
CHANGED
@@ -16,6 +16,10 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install era_ja
|
18
18
|
|
19
|
+
### ruby version ###
|
20
|
+
|
21
|
+
era_ja was run test on ruby 1.9.3 and ruby 2.0.0
|
22
|
+
|
19
23
|
## Usage
|
20
24
|
|
21
25
|
### format string
|
@@ -70,7 +74,7 @@ Report issues and feature requests to github Issues. https://github.com/tomiacan
|
|
70
74
|
|
71
75
|
I think about the era and there is a problem in the following.
|
72
76
|
|
73
|
-
* The date in the lunar calendar Although it is September 8,
|
77
|
+
* The date in the lunar calendar Although it is September 8, 1868 the start of the Meiji era.
|
74
78
|
* Start date Taisho, Showa is the same day as the last day of the Meiji, Taisho, respectively.
|
75
79
|
* [昭和ト改元](http://ja.wikisource.org/wiki/%e6%98%ad%e5%92%8c%e3%83%88%e6%94%b9%e5%85%83)
|
76
80
|
* [大正十五年十二月ニ十五日以後ヲ改メテ昭和元年ト爲ス](http://ja.wikisource.org/wiki/%e5%a4%a7%e6%ad%a3%e5%8d%81%e4%ba%94%e5%b9%b4%e5%8d%81%e4%ba%8c%e6%9c%88%e3%83%8b%e5%8d%81%e4%ba%94%e6%97%a5%e4%bb%a5%e5%be%8c%e3%83%b2%e6%94%b9%e3%83%a1%e3%83%86%e6%98%ad%e5%92%8c%e5%85%83%e5%b9%b4%e3%83%88%e7%88%b2%e3%82%b9)
|
data/era_ja.gemspec
CHANGED
@@ -15,9 +15,9 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = EraJa::VERSION
|
17
17
|
|
18
|
-
gem.add_development_dependency "rake", '~> 10.0
|
19
|
-
gem.add_development_dependency 'rspec', '~> 2.
|
20
|
-
gem.add_development_dependency "guard-rspec", '~>
|
18
|
+
gem.add_development_dependency "rake", '~> 10.1.0'
|
19
|
+
gem.add_development_dependency 'rspec', '~> 2.14.1'
|
20
|
+
gem.add_development_dependency "guard-rspec", '~> 4.0.3'
|
21
21
|
gem.add_development_dependency 'rb-fsevent', '~> 0.9.3'
|
22
22
|
gem.add_development_dependency 'terminal-notifier-guard', '~> 1.5.3'
|
23
23
|
end
|
data/lib/era_ja.rb
CHANGED
@@ -22,7 +22,7 @@ module EraJa
|
|
22
22
|
str_time = strftime(@era_format)
|
23
23
|
if @era_format =~ /%E/
|
24
24
|
if self.to_time < ::Time.mktime(1868,9,8)
|
25
|
-
raise "#to_era is expeted later in
|
25
|
+
raise "#to_era is expeted later in 1868,9,8"
|
26
26
|
elsif self.to_time < ::Time.mktime(1912,7,30)
|
27
27
|
str_time = era_year(year - 1867, 'M')
|
28
28
|
elsif self.to_time < ::Time.mktime(1926,12,25)
|
data/lib/era_ja/version.rb
CHANGED
data/spec/date_spec.rb
CHANGED
@@ -47,8 +47,8 @@ describe Date do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
context "date is 1868,9,7" do
|
50
|
-
|
51
|
-
|
50
|
+
subject { Date.new(1868,9,7) }
|
51
|
+
include_examples "1868,9,7"
|
52
52
|
end
|
53
53
|
|
54
54
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -97,6 +97,9 @@ shared_examples "should equal 'M01.09.08'" do
|
|
97
97
|
it { subject.to_era.should eq "M01.09.08" }
|
98
98
|
end
|
99
99
|
|
100
|
+
shared_examples "should raise error" do
|
101
|
+
it { expect {subject.to_era}.to raise_error(RuntimeError, "#to_era is expeted later in 1868,9,8") }
|
102
|
+
end
|
100
103
|
|
101
104
|
shared_examples "2012,4,29" do
|
102
105
|
include_examples "should equal 'H24.04.29'"
|
@@ -139,3 +142,7 @@ end
|
|
139
142
|
shared_examples "1868,9,8" do
|
140
143
|
include_examples "should equal 'M01.09.08'"
|
141
144
|
end
|
145
|
+
|
146
|
+
shared_examples "1868,9,7" do
|
147
|
+
include_examples "should raise error"
|
148
|
+
end
|
data/spec/time_spec.rb
CHANGED
@@ -47,8 +47,8 @@ describe Time do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
context "time is 1868,9,7" do
|
50
|
-
|
51
|
-
|
50
|
+
subject { Time.mktime(1868,9,7) }
|
51
|
+
include_examples "1868,9,7"
|
52
52
|
end
|
53
53
|
|
54
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: era_ja
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 10.0
|
21
|
+
version: 10.1.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 10.0
|
29
|
+
version: 10.1.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rspec
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 2.
|
37
|
+
version: 2.14.1
|
38
38
|
type: :development
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 2.
|
45
|
+
version: 2.14.1
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: guard-rspec
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 4.0.3
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 4.0.3
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: rb-fsevent
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
129
|
version: '0'
|
130
130
|
segments:
|
131
131
|
- 0
|
132
|
-
hash: -
|
132
|
+
hash: -1696226539030765327
|
133
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
134
|
none: false
|
135
135
|
requirements:
|
@@ -138,10 +138,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
version: '0'
|
139
139
|
segments:
|
140
140
|
- 0
|
141
|
-
hash: -
|
141
|
+
hash: -1696226539030765327
|
142
142
|
requirements: []
|
143
143
|
rubyforge_project:
|
144
|
-
rubygems_version: 1.8.
|
144
|
+
rubygems_version: 1.8.23
|
145
145
|
signing_key:
|
146
146
|
specification_version: 3
|
147
147
|
summary: Convert Date or Time instance to String of Japanese era.
|