dates_from_string 1.2.1 → 1.2.2
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.rb +6 -4
- data/lib/dates_from_string/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d5ae34120cfd20381e8ea4fb005d4733c0dc623
|
4
|
+
data.tar.gz: 18e134d732f77df7a41f0b00c368c6ac2fab3c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ec06d3b9db6b1ff654aa214290e535eff849befb5810369f9a2a6440e0c8ffc4d23e6c6f6b118c17f5b3f05ac9f0c32c8e0602414885789e4a862c9a4986b1b
|
7
|
+
data.tar.gz: 64b4ea464200375891453194d69e5036cfd3e627c8f6d01beaa4de85830e75cc96f6d643f99959cb0fce5670bf16d4bcbde14aded301ae49a164c3bf15d24248
|
data/lib/dates_from_string.rb
CHANGED
@@ -19,15 +19,19 @@ class DatesFromString
|
|
19
19
|
] => -> string { string.to_s.split("-").reverse },
|
20
20
|
[
|
21
21
|
/\d{4}\.\d{2}\.\d{2}/,
|
22
|
+
/\d{4}\.\d{2}\.\d{1}/,
|
22
23
|
] => -> string { string.to_s.split(".") },
|
23
24
|
[
|
24
25
|
/\d{2}\.\d{2}\.\d{4}/,
|
26
|
+
/\d{1}\.\d{2}\.\d{4}/,
|
25
27
|
] => -> string { string.to_s.split(".").reverse },
|
26
28
|
[
|
27
29
|
/\d{4}\/\d{2}\/\d{2}/,
|
30
|
+
/\d{4}\/\d{2}\/\d{1}/,
|
28
31
|
] => -> string { string.to_s.split("/") },
|
29
32
|
[
|
30
33
|
/\d{2}\/\d{2}\/\d{4}/,
|
34
|
+
/\d{1}\/\d{2}\/\d{4}/,
|
31
35
|
] => -> string { string.to_s.split("/").reverse },
|
32
36
|
}
|
33
37
|
|
@@ -150,18 +154,16 @@ class DatesFromString
|
|
150
154
|
end
|
151
155
|
|
152
156
|
def get_full_date(string)
|
153
|
-
|
154
157
|
PATTERNS.keys.each do |patterns|
|
155
158
|
patterns.each do |pattern|
|
156
159
|
if (result = string.match(pattern))
|
157
160
|
@clear_text.slice!(result.to_s)
|
158
|
-
return
|
161
|
+
return PATTERNS[patterns].call result
|
159
162
|
end
|
160
163
|
end
|
161
164
|
end
|
162
165
|
|
163
|
-
|
164
|
-
|
166
|
+
nil
|
165
167
|
end
|
166
168
|
|
167
169
|
def get_month_year_date(string)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dates_from_string
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Chechaev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|