era_ja 0.5.0 → 0.5.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/lib/era_ja/conversion.rb +1 -1
- data/lib/era_ja/version.rb +1 -1
- data/spec/spec_helper.rb +21 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f598fc29cf59de25fc7e72030f3db338273480d3
|
4
|
+
data.tar.gz: e6ca339e1929da8c1fb3bcc1a2ee7042eb1f2478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 238fd1d45d406b0f4cb30e5e5294996bed383d798ed9fb4fc2092e5cbedf07608189a8ce75c153f434ccce4ed54d45d8bebaebd7bf255a52da2e96486a2008ef
|
7
|
+
data.tar.gz: 47f9138085cb5742e0107cab463c54c9ab6a14d88d93b232d0828d35ebdce272558652d1ce3fffe499616e1b2eead9d5799a87947cb7825dd194c6333be422d1
|
data/lib/era_ja/conversion.rb
CHANGED
@@ -29,7 +29,7 @@ module EraJa
|
|
29
29
|
def to_era(format = "%o%E.%m.%d", era_names: ERA_NAME_DEFAULTS)
|
30
30
|
@era_format = format.gsub(/%J/, "%J%")
|
31
31
|
str_time = strftime(@era_format)
|
32
|
-
if @era_format =~ /%
|
32
|
+
if @era_format =~ /%([EOo]|1O)/
|
33
33
|
case
|
34
34
|
when self.to_time < ::Time.mktime(1868,9,8)
|
35
35
|
raise ERR_DATE_OUT_OF_RANGE
|
data/lib/era_ja/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -92,6 +92,24 @@ RSpec.shared_examples "should equal '二千十二年四月二十九日'" do
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
+
RSpec.shared_examples "should equal '平成'" do
|
96
|
+
context "with '%O'" do
|
97
|
+
it { expect(subject.to_era('%O')).to eq '平成' }
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
RSpec.shared_examples "should equal '平'" do
|
102
|
+
context "with '%1O'" do
|
103
|
+
it { expect(subject.to_era('%1O')).to eq '平' }
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
RSpec.shared_examples "should equal 'H'" do
|
108
|
+
context "with '%o'" do
|
109
|
+
it { expect(subject.to_era('%o')).to eq 'H' }
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
95
113
|
RSpec.shared_examples "should equal 'H01.01.08'" do
|
96
114
|
context "without argument" do
|
97
115
|
it { expect(subject.to_era).to eq "H01.01.08" }
|
@@ -166,6 +184,9 @@ RSpec.shared_examples "2012,4,29" do
|
|
166
184
|
include_examples "should equal '2012年04月29日'"
|
167
185
|
include_examples "should equal '平成二十四年四月二十九日'"
|
168
186
|
include_examples "should equal '二千十二年四月二十九日'"
|
187
|
+
include_examples "should equal '平成'"
|
188
|
+
include_examples "should equal '平'"
|
189
|
+
include_examples "should equal 'H'"
|
169
190
|
end
|
170
191
|
|
171
192
|
RSpec.shared_examples "1989,1,8" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: era_ja
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.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: 2017-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.5.1
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: Convert Date or Time instance to String of Japanese era.
|