parse_date 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b89915718c893cf65a79dfd4d589b9c1e7def99b00f56dcfee56829c5c0941e1
4
- data.tar.gz: 96803f595b7a6d6e95f331661e48254eee0204a0d0d856bc83d46bbfe67f72a4
3
+ metadata.gz: 42b7b5f7405ee4a79e7eece920b10fe2852a03c996b32da8c2b8edc58a6e3ede
4
+ data.tar.gz: eeba668fd1ee75994f743a010dbe37af4ffdcb8ca0c4143ca329c811739c4b28
5
5
  SHA512:
6
- metadata.gz: df38bb2a88a9417f660a2e03fe642fafd3e82db85999a81d7897b8bb8577d1670a5810359bdadae0134c4edf128e4e44bcdbc59fc9bdcab94955bac2eed6afc0
7
- data.tar.gz: a73425d3c6c2a1b8c75e4f577463ff2b321a8dc93d8f35be5318b3e58c83e2f0a3984be67397dd7a14b5380b429eb1d4e6d5edb7383c23f5b7fe94937d8379e4
6
+ metadata.gz: a22f1e23899efc15e5fd13ab1aac724cddc39ddf9986d0295e2f4360b639483da116ef4540bb35fc0c03cf201c0d29f4e0ac6729339140663ff7622ed8a7a623
7
+ data.tar.gz: df518ca44ed63ea2925976fe49a11e28cd4ecc40b66752c7db11934d4bba6fe7ade795aca93402cb0f556816cf076e40006e08294162b8f01c527377a4603e51
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-10-24 13:45:33 -0700 using RuboCop version 0.74.0.
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: 39
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: 176
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*-\s*(?<last>\d{4})\??/m)
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*-\s*(?<last>\d{2})\??([^-0-9].*)?$/)
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 = Regexp.new("(?<first>#{YYUU})\\??\\s*-\\s*(?<last>#{YYUU})\\??([^u\\-]|$)??", REGEX_OPTS)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ParseDate
4
- VERSION = '0.3.2'
4
+ VERSION = '0.3.3'
5
5
  end
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.2
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-24 00:00:00.000000000 Z
11
+ date: 2019-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk