parse_date 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +3 -3
- data/lib/parse_date/int_from_string.rb +5 -3
- 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: 42b7b5f7405ee4a79e7eece920b10fe2852a03c996b32da8c2b8edc58a6e3ede
|
4
|
+
data.tar.gz: eeba668fd1ee75994f743a010dbe37af4ffdcb8ca0c4143ca329c811739c4b28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a22f1e23899efc15e5fd13ab1aac724cddc39ddf9986d0295e2f4360b639483da116ef4540bb35fc0c03cf201c0d29f4e0ac6729339140663ff7622ed8a7a623
|
7
|
+
data.tar.gz: df518ca44ed63ea2925976fe49a11e28cd4ecc40b66752c7db11934d4bba6fe7ade795aca93402cb0f556816cf076e40006e08294162b8f01c527377a4603e51
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2019-10-
|
3
|
+
# on 2019-10-28 09:19:23 -0700 using RuboCop version 0.74.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
# Offense count: 5
|
10
10
|
Metrics/AbcSize:
|
11
|
-
Max:
|
11
|
+
Max: 41
|
12
12
|
|
13
13
|
# Offense count: 4
|
14
14
|
Metrics/CyclomaticComplexity:
|
@@ -17,7 +17,7 @@ Metrics/CyclomaticComplexity:
|
|
17
17
|
# Offense count: 1
|
18
18
|
# Configuration parameters: CountComments.
|
19
19
|
Metrics/ModuleLength:
|
20
|
-
Max:
|
20
|
+
Max: 178
|
21
21
|
|
22
22
|
# Offense count: 4
|
23
23
|
Metrics/PerceivedComplexity:
|
@@ -63,6 +63,7 @@ class ParseDate
|
|
63
63
|
result ||= ParseDate.send(:yyuu_after_hyphen, date_str)
|
64
64
|
result ||= ParseDate.send(:year_after_or, date_str)
|
65
65
|
result ||= ParseDate.send(:negative_4digits_after_hyphen, date_str)
|
66
|
+
result ||= ParseDate.send(:negative_first_four_digits, date_str)
|
66
67
|
result ||= ParseDate.send(:first_four_digits, date_str)
|
67
68
|
result ||= ParseDate.send(:year_from_mm_dd_yy, date_str)
|
68
69
|
result ||= ParseDate.send(:last_year_for_decade, date_str) # 198x or 201x
|
@@ -96,7 +97,7 @@ class ParseDate
|
|
96
97
|
date_str.delete('[]') if date_str.match(BRACKETS_BETWEEN_DIGITS_REGEX)
|
97
98
|
end
|
98
99
|
|
99
|
-
YYYY_HYPHEN_YYYY_REGEX = Regexp.new(/(?<first>\d{4})\??\s
|
100
|
+
YYYY_HYPHEN_YYYY_REGEX = Regexp.new(/(?<first>\d{4})\??\s*[-—]\s*(?<last>\d{4})\??/m)
|
100
101
|
|
101
102
|
# Integer value for latest year if we have "yyyy-yyyy" pattern
|
102
103
|
# @return [Integer, nil] yyyy if date_str matches pattern; nil otherwise
|
@@ -104,7 +105,7 @@ class ParseDate
|
|
104
105
|
Regexp.last_match(:last).to_i if date_str.match(YYYY_HYPHEN_YYYY_REGEX)
|
105
106
|
end
|
106
107
|
|
107
|
-
YYYY_HYPHEN_YY_REGEX = Regexp.new(/(?<first>\d{4})\??\s
|
108
|
+
YYYY_HYPHEN_YY_REGEX = Regexp.new(/(?<first>\d{4})\??\s*[-—]\s*(?<last>\d{2})\??([^-0-9].*)?$/)
|
108
109
|
|
109
110
|
# Integer value for latest year if we have "yyyy-yy" pattern
|
110
111
|
# @return [Integer, nil] yyyy if date_str matches pattern; nil otherwise
|
@@ -119,7 +120,8 @@ class ParseDate
|
|
119
120
|
end
|
120
121
|
|
121
122
|
YYUU = '\\d{1,2}[u\\-]{2}'
|
122
|
-
YYuu_HYPHEN_YYuu_REGEX =
|
123
|
+
YYuu_HYPHEN_YYuu_REGEX =
|
124
|
+
Regexp.new("(?<first>#{YYUU})\\??\\s*[-—]\\s*(?<last>#{YYUU})\\??([^u\\-]|$)??", REGEX_OPTS)
|
123
125
|
|
124
126
|
# Integer value for latest year if we have "yyuu-yyuu" pattern
|
125
127
|
# @return [Integer, nil] yyyy if date_str matches pattern; nil otherwise
|
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.3.
|
4
|
+
version: 0.3.3
|
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-10-
|
11
|
+
date: 2019-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|