era_ja 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3dc968407d2aa1d8d89f19820529c1ec39b646bf
4
- data.tar.gz: 7c695884e466ccb5cd18fcdb60a5ac3b87bdda1f
3
+ metadata.gz: f598fc29cf59de25fc7e72030f3db338273480d3
4
+ data.tar.gz: e6ca339e1929da8c1fb3bcc1a2ee7042eb1f2478
5
5
  SHA512:
6
- metadata.gz: 058f66ea666f5f3a158061d26fcb0a7f696ae1973cbc3b0adb2150bddb2e0f0b1ff03d34247375df55a6974cc99e61fbbb13c76d5657213cdeb44445a0d2e1c3
7
- data.tar.gz: 21f3aa1bd3ab10df432c69d827d6624d8f1df1b548ae562c0304577ec3f04cf6d944f9e0084ec06780af0d7be6ae8ad79fd453b7811fd6e7471c9bdc2e152ca6
6
+ metadata.gz: 238fd1d45d406b0f4cb30e5e5294996bed383d798ed9fb4fc2092e5cbedf07608189a8ce75c153f434ccce4ed54d45d8bebaebd7bf255a52da2e96486a2008ef
7
+ data.tar.gz: 47f9138085cb5742e0107cab463c54c9ab6a14d88d93b232d0828d35ebdce272558652d1ce3fffe499616e1b2eead9d5799a87947cb7825dd194c6333be422d1
@@ -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 =~ /%E/
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
@@ -1,3 +1,3 @@
1
1
  module EraJa
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -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.0
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: 2016-02-07 00:00:00.000000000 Z
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.4.5.1
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.