parse_date 0.3.4 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/lib/parse_date.rb +1 -0
- data/lib/parse_date/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 367f2e3cc7710655783c53692b76d6c483be5dd197047b0a285857c2e8b29b10
|
4
|
+
data.tar.gz: 37da36fa61807abcc852bb1dc4c5f4f05313dc87e25ad6d03db7a3f64da34998
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31a6ec4a2b621f6689ecc4151f7809e3fc861a491382117350f2b9404db6f6c753206dc263d028b04a54aaa23b14c8cfcf036d3de7139d1f61dd3a3fdfb07d6e
|
7
|
+
data.tar.gz: 289196806a4c8acba6904525adb65e5afe429dd5ee74acfb9ae75ea30980bc52f0ef1112871f948e0cd0454a9e0b303ac407b030d4562f8eac898cf3f8f5a6fe
|
data/README.md
CHANGED
@@ -67,9 +67,11 @@ ParseDate.parse_range('996–1021 CE') # (996..1021).to_a (di
|
|
67
67
|
ParseDate.parse_range('1975 - 1905') # last year > first year, raises error
|
68
68
|
ParseDate.parse_range('-100 - -150') # last year > first year, raises error
|
69
69
|
ParseDate.parse_range('1975 or 1905') # last year > first year, raises error
|
70
|
-
ParseDate.parse_range('2050')
|
71
|
-
ParseDate.parse_range('
|
72
|
-
ParseDate.parse_range(
|
70
|
+
ParseDate.parse_range('1975 - 2050') # single invalid year endpoint, raises error
|
71
|
+
ParseDate.parse_range('2050') # nil - only invalid year endpoints present
|
72
|
+
ParseDate.parse_range('2045 - 2050') # nil - only invalid year endpoints present
|
73
|
+
ParseDate.parse_range('random text') # nil - can't parse years
|
74
|
+
ParseDate.parse_range(nil) # nil - can't parse years
|
73
75
|
|
74
76
|
ParseDate.earliest_year('12/25/00') # 2000
|
75
77
|
ParseDate.earliest_year('5-1-21') # 1921
|
data/lib/parse_date.rb
CHANGED
@@ -42,6 +42,7 @@ class ParseDate
|
|
42
42
|
def self.parse_range(date_str)
|
43
43
|
first = earliest_year(date_str)
|
44
44
|
last = latest_year(date_str)
|
45
|
+
return nil unless first || last
|
45
46
|
raise ParseDate::Error, "Unable to parse range from '#{date_str}'" unless year_range_valid?(first, last)
|
46
47
|
|
47
48
|
range_array(first, last)
|
data/lib/parse_date/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parse_date
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naomi Dushay
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|