dates_from_string 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dates_from_string/version.rb +1 -1
- data/lib/dates_from_string.rb +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce5ca5eeda2096485eb46bd32dffbea36d9d7303
|
4
|
+
data.tar.gz: 26db1fe8ad81a31c76215cf74df75cd3cd4d3e3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21e956e1ddfcab3cf25a66cc72082890691aa3e14b9f3cd638831a3006b41b29cdfbe31417e9cb7ad28aa58f9a24b5efe5df76f2fdb6376e3d823a7c150bdd85
|
7
|
+
data.tar.gz: 87141f753df9b55fceb2e9b34e741a36672b3ca5c1f07bfda1be597fdea978723bc7e03d7ab22da91af1168ad38c7951fa4c2135a8800a211828c93986cf0c39
|
data/lib/dates_from_string.rb
CHANGED
@@ -61,6 +61,10 @@ class DatesFromString
|
|
61
61
|
def get_year(string)
|
62
62
|
if string =~ /^\d{4}$/
|
63
63
|
string
|
64
|
+
elsif string =~ /^\d{4}\.$/
|
65
|
+
string.delete!('.')
|
66
|
+
elsif string =~ /^\d{4}\,$/
|
67
|
+
string.delete!(',')
|
64
68
|
else
|
65
69
|
nil
|
66
70
|
end
|
@@ -96,8 +100,10 @@ class DatesFromString
|
|
96
100
|
|
97
101
|
|
98
102
|
def get_dash_data(string)
|
99
|
-
if
|
100
|
-
|
103
|
+
if (result = string.match(/\d{4}-\d{4}/))
|
104
|
+
result.to_s.split("-")
|
105
|
+
elsif (result = string.match(/\d{4}–\d{4}/))
|
106
|
+
result.to_s.split("–")
|
101
107
|
else
|
102
108
|
nil
|
103
109
|
end
|