era_ja 0.3.0 → 0.3.1
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/Guardfile +1 -1
- data/era_ja.gemspec +4 -4
- data/lib/era_ja/conversion.rb +1 -1
- data/lib/era_ja/version.rb +1 -1
- data/spec/date_spec.rb +1 -1
- data/spec/spec_helper.rb +48 -48
- data/spec/time_spec.rb +1 -1
- metadata +26 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccca4808e214d0277f4dc83b3a3a7f131b619807
|
4
|
+
data.tar.gz: ac2d02db9b31485f244ce04ff8938fdee6530693
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f1a77b0833a94bcc00fbdbe47a051cd45e876ada349637c9a6d0eb243dd3e86b4d5b83e076b158726c24a26f4c45e52e0a571d7a8e8e042a9befd333b7e12c8
|
7
|
+
data.tar.gz: f3a48f2bb1b1632e6b2bfd6e0cd8302d170a44c2e19cb8fa42d3286aa691e6988b0fcfd008c7d671deb6138cd1587d0a44b7a43ec510f7e6b412c1eabfc3a452
|
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', :cmd => 'rspec --color --format progress', :all_after_pass => false do
|
5
|
+
guard 'rspec', :cmd => 'bundle exec 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/era_ja.gemspec
CHANGED
@@ -17,8 +17,8 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.license = "MIT"
|
18
18
|
|
19
19
|
gem.add_development_dependency "rake", '~> 10.1.0'
|
20
|
-
gem.add_development_dependency 'rspec', '~>
|
21
|
-
gem.add_development_dependency "guard-rspec", '~> 4.0
|
22
|
-
gem.add_development_dependency 'rb-fsevent', '~> 0.9.
|
23
|
-
gem.add_development_dependency 'terminal-notifier-guard', '~> 1.
|
20
|
+
gem.add_development_dependency 'rspec', '~> 3.1.0'
|
21
|
+
gem.add_development_dependency "guard-rspec", '~> 4.5.0'
|
22
|
+
gem.add_development_dependency 'rb-fsevent', '~> 0.9.4'
|
23
|
+
gem.add_development_dependency 'terminal-notifier-guard', '~> 1.6.4'
|
24
24
|
end
|
data/lib/era_ja/conversion.rb
CHANGED
@@ -15,7 +15,7 @@ module EraJa
|
|
15
15
|
# * %J - kanzi number
|
16
16
|
# @return [String]
|
17
17
|
def to_era(format = "%o%E.%m.%d")
|
18
|
-
@era_format = format
|
18
|
+
@era_format = format.dup
|
19
19
|
@era_format.gsub!(/%J/, "%J%")
|
20
20
|
@era_format.sub!(/%o/i) { |m| m + ' ' }
|
21
21
|
@era_format.sub!(/%E/) { |m| m + ' ' }
|
data/lib/era_ja/version.rb
CHANGED
data/spec/date_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,107 +1,107 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require 'rspec'
|
3
3
|
|
4
|
-
shared_examples "should equal 'H24.04.29'" do
|
5
|
-
it { subject.to_era.
|
4
|
+
RSpec.shared_examples "should equal 'H24.04.29'" do
|
5
|
+
it { expect(subject.to_era).to eq "H24.04.29" }
|
6
6
|
|
7
7
|
context "with '%o%E.%m.%d'" do
|
8
|
-
it { subject.to_era("%o%E.%m.%d").
|
8
|
+
it { expect(subject.to_era("%o%E.%m.%d")).to eq "H24.04.29" }
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
shared_examples "should equal '平成24年04月29日'" do
|
12
|
+
RSpec.shared_examples "should equal '平成24年04月29日'" do
|
13
13
|
context "with '%O%E年%m月%d日'" do
|
14
|
-
it { subject.to_era("%O%E年%m月%d日").
|
14
|
+
it { expect(subject.to_era("%O%E年%m月%d日")).to eq "平成24年04月29日" }
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
shared_examples "should equal '24.04.29'" do
|
18
|
+
RSpec.shared_examples "should equal '24.04.29'" do
|
19
19
|
context "with '%E.%m.%d'" do
|
20
|
-
it { subject.to_era("%E.%m.%d").
|
20
|
+
it { expect(subject.to_era("%E.%m.%d")).to eq "24.04.29" }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
shared_examples "should equal '2404'" do
|
24
|
+
RSpec.shared_examples "should equal '2404'" do
|
25
25
|
context "with '%E%m'" do
|
26
|
-
it { subject.to_era("%E%m").
|
26
|
+
it { expect(subject.to_era("%E%m")).to eq "2404" }
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
shared_examples "should equal '平成240429'" do
|
30
|
+
RSpec.shared_examples "should equal '平成240429'" do
|
31
31
|
context "with '%O%E%m%d'" do
|
32
|
-
it { subject.to_era("%O%E%m%d").
|
32
|
+
it { expect(subject.to_era("%O%E%m%d")).to eq '平成240429' }
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
shared_examples "should equal '平成二十四年四月二十九日'" do
|
36
|
+
RSpec.shared_examples "should equal '平成二十四年四月二十九日'" do
|
37
37
|
context "with '%O%JE年%Jm月%Jd日'" do
|
38
|
-
it { subject.to_era('%O%JE年%Jm月%Jd日').
|
38
|
+
it { expect(subject.to_era('%O%JE年%Jm月%Jd日')).to eq '平成二十四年四月二十九日' }
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
shared_examples "should equal '2012年04月29日'" do
|
42
|
+
RSpec.shared_examples "should equal '2012年04月29日'" do
|
43
43
|
context "with '%y年%m月%d日'" do
|
44
|
-
it { subject.to_era('%Y年%m月%d日').
|
44
|
+
it { expect(subject.to_era('%Y年%m月%d日')).to eq '2012年04月29日' }
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
shared_examples "should equal '二千十二年四月二十九日'" do
|
48
|
+
RSpec.shared_examples "should equal '二千十二年四月二十九日'" do
|
49
49
|
context "with '%Jy年%Jm月%Jd日'" do
|
50
|
-
it { subject.to_era('%JY年%Jm月%Jd日').
|
50
|
+
it { expect(subject.to_era('%JY年%Jm月%Jd日')).to eq '二千十二年四月二十九日' }
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
shared_examples "should equal 'H01.01.08'" do
|
54
|
+
RSpec.shared_examples "should equal 'H01.01.08'" do
|
55
55
|
context "without argument" do
|
56
|
-
it { subject.to_era.
|
56
|
+
it { expect(subject.to_era).to eq "H01.01.08" }
|
57
57
|
end
|
58
58
|
|
59
59
|
context "with '%O%JE.%Jm.%Jd'" do
|
60
|
-
it { subject.to_era('%O%JE.%Jm.%Jd').
|
60
|
+
it { expect(subject.to_era('%O%JE.%Jm.%Jd')).to eq "平成元.一.八" }
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
shared_examples "should equal 'S64.01.07'" do
|
65
|
-
it { subject.to_era.
|
64
|
+
RSpec.shared_examples "should equal 'S64.01.07'" do
|
65
|
+
it { expect(subject.to_era).to eq "S64.01.07" }
|
66
66
|
end
|
67
67
|
|
68
|
-
shared_examples "should equal '昭和64.01.07'" do
|
69
|
-
it { subject.to_era("%O%E.%m.%d").
|
68
|
+
RSpec.shared_examples "should equal '昭和64.01.07'" do
|
69
|
+
it { expect(subject.to_era("%O%E.%m.%d")).to eq "昭和64.01.07" }
|
70
70
|
end
|
71
71
|
|
72
|
-
shared_examples "should equal 'S01.12.25'" do
|
73
|
-
it { subject.to_era.
|
72
|
+
RSpec.shared_examples "should equal 'S01.12.25'" do
|
73
|
+
it { expect(subject.to_era).to eq "S01.12.25" }
|
74
74
|
end
|
75
75
|
|
76
|
-
shared_examples "should equal 'T15.12.24'" do
|
77
|
-
it { subject.to_era.
|
76
|
+
RSpec.shared_examples "should equal 'T15.12.24'" do
|
77
|
+
it { expect(subject.to_era).to eq "T15.12.24" }
|
78
78
|
end
|
79
79
|
|
80
|
-
shared_examples "should equal 'T01.07.30'" do
|
81
|
-
it { subject.to_era.
|
80
|
+
RSpec.shared_examples "should equal 'T01.07.30'" do
|
81
|
+
it { expect(subject.to_era).to eq "T01.07.30" }
|
82
82
|
end
|
83
83
|
|
84
|
-
shared_examples "should equal '大正01.07.30'" do
|
85
|
-
it { subject.to_era("%O%E.%m.%d").
|
84
|
+
RSpec.shared_examples "should equal '大正01.07.30'" do
|
85
|
+
it { expect(subject.to_era("%O%E.%m.%d")).to eq "大正01.07.30" }
|
86
86
|
end
|
87
87
|
|
88
|
-
shared_examples "should equal 'M45.07.29'" do
|
89
|
-
it { subject.to_era.
|
88
|
+
RSpec.shared_examples "should equal 'M45.07.29'" do
|
89
|
+
it { expect(subject.to_era).to eq "M45.07.29" }
|
90
90
|
end
|
91
91
|
|
92
|
-
shared_examples "should equal '明治45.07.29'" do
|
93
|
-
it { subject.to_era("%O%E.%m.%d").
|
92
|
+
RSpec.shared_examples "should equal '明治45.07.29'" do
|
93
|
+
it { expect(subject.to_era("%O%E.%m.%d")).to eq "明治45.07.29" }
|
94
94
|
end
|
95
95
|
|
96
|
-
shared_examples "should equal 'M01.09.08'" do
|
97
|
-
it { subject.to_era.
|
96
|
+
RSpec.shared_examples "should equal 'M01.09.08'" do
|
97
|
+
it { expect(subject.to_era).to eq "M01.09.08" }
|
98
98
|
end
|
99
99
|
|
100
|
-
shared_examples "should raise error" do
|
100
|
+
RSpec.shared_examples "should raise error" do
|
101
101
|
it { expect {subject.to_era}.to raise_error(RuntimeError, "#to_era is expeted later in 1868,9,8") }
|
102
102
|
end
|
103
103
|
|
104
|
-
shared_examples "2012,4,29" do
|
104
|
+
RSpec.shared_examples "2012,4,29" do
|
105
105
|
include_examples "should equal 'H24.04.29'"
|
106
106
|
include_examples "should equal '平成24年04月29日'"
|
107
107
|
include_examples "should equal '24.04.29'"
|
@@ -112,37 +112,37 @@ shared_examples "2012,4,29" do
|
|
112
112
|
include_examples "should equal '二千十二年四月二十九日'"
|
113
113
|
end
|
114
114
|
|
115
|
-
shared_examples "1989,1,8" do
|
115
|
+
RSpec.shared_examples "1989,1,8" do
|
116
116
|
include_examples "should equal 'H01.01.08'"
|
117
117
|
end
|
118
118
|
|
119
|
-
shared_examples "1989,1,7" do
|
119
|
+
RSpec.shared_examples "1989,1,7" do
|
120
120
|
include_examples "should equal 'S64.01.07'"
|
121
121
|
include_examples "should equal '昭和64.01.07'"
|
122
122
|
end
|
123
123
|
|
124
|
-
shared_examples "1926,12,25" do
|
124
|
+
RSpec.shared_examples "1926,12,25" do
|
125
125
|
include_examples "should equal 'S01.12.25'"
|
126
126
|
end
|
127
127
|
|
128
|
-
shared_examples "1926,12,24" do
|
128
|
+
RSpec.shared_examples "1926,12,24" do
|
129
129
|
include_examples "should equal 'T15.12.24'"
|
130
130
|
end
|
131
131
|
|
132
|
-
shared_examples "1912,7,30" do
|
132
|
+
RSpec.shared_examples "1912,7,30" do
|
133
133
|
include_examples "should equal 'T01.07.30'"
|
134
134
|
include_examples "should equal '大正01.07.30'"
|
135
135
|
end
|
136
136
|
|
137
|
-
shared_examples "1912,7,29" do
|
137
|
+
RSpec.shared_examples "1912,7,29" do
|
138
138
|
include_examples "should equal 'M45.07.29'"
|
139
139
|
include_examples "should equal '明治45.07.29'"
|
140
140
|
end
|
141
141
|
|
142
|
-
shared_examples "1868,9,8" do
|
142
|
+
RSpec.shared_examples "1868,9,8" do
|
143
143
|
include_examples "should equal 'M01.09.08'"
|
144
144
|
end
|
145
145
|
|
146
|
-
shared_examples "1868,9,7" do
|
146
|
+
RSpec.shared_examples "1868,9,7" do
|
147
147
|
include_examples "should raise error"
|
148
148
|
end
|
data/spec/time_spec.rb
CHANGED
metadata
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: era_ja
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tomi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 10.1.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
26
|
version: 10.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 3.1.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 3.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: guard-rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.0
|
47
|
+
version: 4.5.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.0
|
54
|
+
version: 4.5.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rb-fsevent
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.9.
|
61
|
+
version: 0.9.4
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.9.
|
68
|
+
version: 0.9.4
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: terminal-notifier-guard
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.6.4
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.6.4
|
83
83
|
description: Convert to Japanese era.
|
84
84
|
email:
|
85
85
|
- tomiacannondale@gmail.com
|
@@ -87,9 +87,9 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .document
|
91
|
-
- .gitignore
|
92
|
-
- .yardopts
|
90
|
+
- ".document"
|
91
|
+
- ".gitignore"
|
92
|
+
- ".yardopts"
|
93
93
|
- Gemfile
|
94
94
|
- Guardfile
|
95
95
|
- LICENSE
|
@@ -115,17 +115,17 @@ require_paths:
|
|
115
115
|
- lib
|
116
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
|
-
- -
|
118
|
+
- - ">="
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.4.5.1
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: Convert Date or Time instance to String of Japanese era.
|