flexyear 2.2.1 → 2.2.2

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: 2fb4798c126d9f8ee4d7045436f487f3a679af87
4
- data.tar.gz: f1fc3aad4bbcd29cbaf4955d0079a581b8ac0b85
3
+ metadata.gz: 2ba90e3142ece7c435fd2ee4acc7d7ca19ef77f0
4
+ data.tar.gz: 7880df13f9e0be791c7ec842ae79094d7bf24990
5
5
  SHA512:
6
- metadata.gz: ddf3c28f8240c9d44d61deb52210c9f8872e767c4640dd8ce727f7e1418cc96aa2806c4826cf379e9450f05a14c3aaea528f940a28bcf254c5b0bf5bca8fcc1f
7
- data.tar.gz: d9d213c018110dde753c7bdcba2eeb5a5f1a0971df51ae9eb37b3cfa1d7c4a0912b931d95f24d2e762ee68d9315c4caf92c272e486ff6d8ccbbe5b166a31d156
6
+ metadata.gz: d993fd9336e03ae8563077141830884fc2efdeeb3f1eb9ed4aee6f92f4282fa1cfcc40395848ddd5849669d16dae4408cf56330cf196e7bea97cdb2cca5f13aa
7
+ data.tar.gz: c9fc713af6a53ab7551a47a2c949a8a30a8e01fd567f98dfe98d08da226fc7c27dcdb482bfd2cc42e34ca070eeb731e7503844839a85f662208ded0061297722
@@ -1,3 +1,3 @@
1
1
  class FlexYear
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
3
3
  end
data/lib/flexyear.rb CHANGED
@@ -40,6 +40,7 @@ class FlexYear
40
40
  end
41
41
 
42
42
  def decade?
43
+ return false unless year_low && year_high
43
44
  year_low % 10 == 0 && year_high % 10 == 9
44
45
  end
45
46
 
@@ -12,18 +12,21 @@ describe FlexYear do
12
12
  subject { flexyear_class.new("") }
13
13
  its(:year_low) { should be_nil }
14
14
  its(:year_high) { should be_nil }
15
+ its(:decade?) { should eq(false) }
15
16
  end
16
17
 
17
18
  context "given nil" do
18
19
  subject { flexyear_class.new(nil) }
19
20
  its(:year_low) { should be_nil }
20
21
  its(:year_high) { should be_nil }
22
+ its(:decade?) { should eq(false) }
21
23
  end
22
24
 
23
25
  context "text" do
24
26
  subject { flexyear_class.new("something") }
25
27
  its(:year_low) { should be_nil }
26
28
  its(:year_high) { should be_nil }
29
+ its(:decade?) { should eq(false) }
27
30
  end
28
31
 
29
32
  context "given 1979 as number" do
@@ -79,12 +82,14 @@ describe FlexYear do
79
82
  subject { FlexYear.new('before 1973') }
80
83
  its(:year_low) { should be_nil }
81
84
  its(:year_high) { should eq(1973) }
85
+ its(:decade?) { should eq(false) }
82
86
  end
83
87
 
84
88
  context 'given after 1973' do
85
89
  subject { FlexYear.new('after 1973') }
86
90
  its(:year_low) { should eq(1973) }
87
91
  its(:year_high) { should be_nil }
92
+ its(:decade?) { should eq(false) }
88
93
  end
89
94
 
90
95
  ["mid 1970s", "mid 70s", "mid-70s", "mid-70's"].each do |year|
@@ -93,6 +98,7 @@ describe FlexYear do
93
98
  its(:year_low) { should eq(1973) }
94
99
  its(:year_high) { should eq(1976) }
95
100
  its(:to_s) { should eq(year) }
101
+ its(:decade?) { should eq(false) }
96
102
  end
97
103
  end
98
104
 
@@ -101,6 +107,7 @@ describe FlexYear do
101
107
  subject { flexyear_class.new(year) }
102
108
  its(:year_low) { should eq(1970) }
103
109
  its(:year_high) { should eq(1973) }
110
+ its(:decade?) { should eq(false) }
104
111
  end
105
112
  end
106
113
 
@@ -109,6 +116,7 @@ describe FlexYear do
109
116
  subject { flexyear_class.new(year) }
110
117
  its(:year_low) { should eq(1976) }
111
118
  its(:year_high) { should eq(1979) }
119
+ its(:decade?) { should eq(false) }
112
120
  end
113
121
  end
114
122
 
@@ -117,6 +125,7 @@ describe FlexYear do
117
125
  subject { flexyear_class.new(range) }
118
126
  its(:year_low) { should eq(1973) }
119
127
  its(:year_high) { should eq(1975) }
128
+ its(:decade?) { should eq(false) }
120
129
  end
121
130
  end
122
131
 
@@ -124,6 +133,7 @@ describe FlexYear do
124
133
  subject { flexyear_class.new('1975-1973') }
125
134
  its(:year_low) { should eq(1973) }
126
135
  its(:year_high) { should eq(1975) }
136
+ its(:decade?) { should eq(false) }
127
137
  end
128
138
 
129
139
  context "given a range" do
@@ -131,6 +141,7 @@ describe FlexYear do
131
141
  subject { flexyear_class.new(range) }
132
142
  its(:year_low) { should eq(2003) }
133
143
  its(:year_high) { should eq(2004) }
144
+ its(:decade?) { should eq(false) }
134
145
  end
135
146
  end
136
147
 
@@ -139,72 +150,84 @@ describe FlexYear do
139
150
  subject { flexyear_class.new('1973 (Circa)') }
140
151
  its(:year_low) { should eq(1972) }
141
152
  its(:year_high) { should eq(1974) }
153
+ its(:decade?) { should eq(false) }
142
154
  end
143
155
 
144
156
  context 'at the beginning of the string' do
145
157
  subject { flexyear_class.new('Circa 1973') }
146
158
  its(:year_low) { should eq(1972) }
147
159
  its(:year_high) { should eq(1974) }
160
+ its(:decade?) { should eq(false) }
148
161
  end
149
162
 
150
163
  context 'abbreviated' do
151
164
  subject { flexyear_class.new('ca 1973') }
152
165
  its(:year_low) { should eq(1972) }
153
166
  its(:year_high) { should eq(1974) }
167
+ its(:decade?) { should eq(false) }
154
168
  end
155
169
 
156
170
  context 'with dots' do
157
171
  subject { flexyear_class.new('c.a. 1973') }
158
172
  its(:year_low) { should eq(1972) }
159
173
  its(:year_high) { should eq(1974) }
174
+ its(:decade?) { should eq(false) }
160
175
  end
161
176
 
162
177
  context 'with c.' do
163
178
  subject { flexyear_class.new('c. 1973') }
164
179
  its(:year_low) { should eq(1972) }
165
180
  its(:year_high) { should eq(1974) }
181
+ its(:decade?) { should eq(false) }
166
182
  end
167
183
 
168
184
  context 'with ca.' do
169
185
  subject { flexyear_class.new('ca. 1973') }
170
186
  its(:year_low) { should eq(1972) }
171
187
  its(:year_high) { should eq(1974) }
188
+ its(:decade?) { should eq(false) }
172
189
  end
173
190
 
174
191
  context 'with approx.' do
175
192
  subject { flexyear_class.new('approx. 1973') }
176
193
  its(:year_low) { should eq(1972) }
177
194
  its(:year_high) { should eq(1974) }
195
+ its(:decade?) { should eq(false) }
178
196
  end
179
197
 
180
198
  context 'with appxly.' do
181
199
  subject { flexyear_class.new('appxly 1973') }
182
200
  its(:year_low) { should eq(1972) }
183
201
  its(:year_high) { should eq(1974) }
202
+ its(:decade?) { should eq(false) }
184
203
  end
185
204
 
186
205
  context 'with around' do
187
206
  subject { flexyear_class.new('around 1973') }
188
207
  its(:year_low) { should eq(1972) }
189
208
  its(:year_high) { should eq(1974) }
209
+ its(:decade?) { should eq(false) }
190
210
  end
191
211
 
192
212
  context 'with about' do
193
213
  subject { flexyear_class.new('about 1973') }
194
214
  its(:year_low) { should eq(1972) }
195
215
  its(:year_high) { should eq(1974) }
216
+ its(:decade?) { should eq(false) }
196
217
  end
197
218
 
198
219
  context 'with circ' do
199
220
  subject { flexyear_class.new('circ. 1973') }
200
221
  its(:year_low) { should eq(1972) }
201
222
  its(:year_high) { should eq(1974) }
223
+ its(:decade?) { should eq(false) }
202
224
  end
203
225
 
204
226
  context 'with cca' do
205
227
  subject { flexyear_class.new('cca 1973') }
206
228
  its(:year_low) { should eq(1972) }
207
229
  its(:year_high) { should eq(1974) }
230
+ its(:decade?) { should eq(false) }
208
231
  end
209
232
 
210
233
  context 'given 2 character fields' do
@@ -212,12 +235,14 @@ describe FlexYear do
212
235
  subject { flexyear_class.new("73") }
213
236
  its(:year_low) { should eq(1973) }
214
237
  its(:year_high) { should eq(1973) }
238
+ its(:decade?) { should eq(false) }
215
239
  end
216
240
 
217
241
  context "from current century" do
218
242
  subject { flexyear_class.new("06") }
219
243
  its(:year_low) { should eq(2006) }
220
244
  its(:year_high) { should eq(2006) }
245
+ its(:decade?) { should eq(false) }
221
246
  end
222
247
  end
223
248
  end
@@ -227,18 +252,21 @@ describe FlexYear do
227
252
  subject { flexyear_class.new(["1980s", "mid-80s", "1988 - 1999", 2001,]) }
228
253
  its(:year_low) { should eq(1980) }
229
254
  its(:year_high) { should eq(2001) }
255
+ its(:decade?) { should eq(false) }
230
256
  end
231
257
 
232
258
  context "same years" do
233
259
  subject { flexyear_class.new(["1988", "1988"]) }
234
260
  its(:year_low) { should eq(1988) }
235
261
  its(:year_high) { should eq(1988) }
262
+ its(:decade?) { should eq(false) }
236
263
  end
237
264
 
238
265
  context "mixed years with nil" do
239
266
  subject { flexyear_class.new(["1988", "1990s", nil]) }
240
267
  its(:year_low) { should eq(1988) }
241
268
  its(:year_high) { should eq(1999) }
269
+ its(:decade?) { should eq(false) }
242
270
  end
243
271
  end
244
272
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexyear
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Melnick & Yan Pritzker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-29 00:00:00.000000000 Z
11
+ date: 2019-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler