edtf-humanize 2.0.1 → 2.1.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d1b42abe59756665b608da4635e8766f78fb44ac2e658e14365141bf919eae9
|
4
|
+
data.tar.gz: f7a583e56c886eee461568fd2deacbd4769221b48b1f5e6b6f9b2ed68b08420c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7d3799ba863355aefa8afd5fdd09f20bc796cea31609d2015979b36f175ccff9a998019b62901c71d0873ca48dc03c0405f47fce7dd049d2ac801fc763d74f3
|
7
|
+
data.tar.gz: 6233da61c4a069e473336c229cd117e479ce1037d10d789506a32565ff4abed04740ce9fa59df1f8be772aaaa62447e58e9b422f6d72ed8778c9e2a6416e0035
|
@@ -94,16 +94,14 @@ module Edtf
|
|
94
94
|
# '198u' => 198x
|
95
95
|
def apply_if_unspecified_year(date)
|
96
96
|
display = date_precision(date)
|
97
|
-
if date.respond_to?
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
display.gsub!(date.year.to_s, year_substitute)
|
106
|
-
end
|
97
|
+
if date.respond_to?(:unspecified?) && date.unspecified?(:year)
|
98
|
+
year_substitute =
|
99
|
+
date.year_precision.edtf.gsub(
|
100
|
+
/u/,
|
101
|
+
I18n.t('edtf.terms.unspecified_digit_substitute',
|
102
|
+
default: 'x')
|
103
|
+
)
|
104
|
+
display.gsub!(date.year.to_s, year_substitute)
|
107
105
|
end
|
108
106
|
display
|
109
107
|
end
|
@@ -54,7 +54,7 @@ RSpec.describe Edtf::Humanize do
|
|
54
54
|
|
55
55
|
context 'with an unspecified year iso date' do
|
56
56
|
it 'returns a humanized unspecified year ISO date string' do
|
57
|
-
expect(Date.edtf('197u').humanize).to eq('
|
57
|
+
expect(Date.edtf('197u').humanize).to eq('197X')
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -54,7 +54,7 @@ RSpec.describe Edtf::Humanize do
|
|
54
54
|
|
55
55
|
context 'with an unspecified year iso date' do
|
56
56
|
it 'returns a humanized unspecified year ISO date string' do
|
57
|
-
expect(Date.edtf('197u').humanize).to eq('
|
57
|
+
expect(Date.edtf('197u').humanize).to eq('197X')
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -54,7 +54,7 @@ RSpec.describe Edtf::Humanize do
|
|
54
54
|
|
55
55
|
context 'with an unspecified year iso date' do
|
56
56
|
it 'returns a humanized unspecified year ISO date string' do
|
57
|
-
expect(Date.edtf('197u').humanize).to eq('
|
57
|
+
expect(Date.edtf('197u').humanize).to eq('197X')
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edtf-humanize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cory Lown
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -163,21 +163,24 @@ require_paths:
|
|
163
163
|
- lib
|
164
164
|
required_ruby_version: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
|
-
- - "
|
166
|
+
- - ">="
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '2.4'
|
169
|
+
- - "<"
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '4'
|
169
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
173
|
requirements:
|
171
174
|
- - ">="
|
172
175
|
- !ruby/object:Gem::Version
|
173
176
|
version: '0'
|
174
177
|
requirements: []
|
175
|
-
rubygems_version: 3.
|
178
|
+
rubygems_version: 3.2.32
|
176
179
|
signing_key:
|
177
180
|
specification_version: 4
|
178
181
|
summary: This gem adds a humanize method to EDTF dates.
|
179
182
|
test_files:
|
180
|
-
- spec/
|
183
|
+
- spec/edtf_humanize_en_spec.rb
|
181
184
|
- spec/edtf_humanize_fr_spec.rb
|
182
185
|
- spec/edtf_humanize_it_spec.rb
|
183
|
-
- spec/
|
186
|
+
- spec/spec_helper.rb
|