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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1ff5d9790fbe02382f3d6b9c710a37c9ede1ba0
4
- data.tar.gz: 588b58729770607e5524907290527a73176f8148
3
+ metadata.gz: ce5ca5eeda2096485eb46bd32dffbea36d9d7303
4
+ data.tar.gz: 26db1fe8ad81a31c76215cf74df75cd3cd4d3e3f
5
5
  SHA512:
6
- metadata.gz: ed4a93f94544c0ee79b00247f21788e7e226768bf5c41fba38ea207fa78efa92226f7262286eb89ed18564fff455a13275613a9c5a59f539943b2dab81686b9f
7
- data.tar.gz: e28338e409d7605d71bab4ed65270e04b73bb392bd14133c0a8b6e02f55ffd0254d5ec735511ea6ff15ec4024aaad2c239863234e24a25d501214aeec98889c7
6
+ metadata.gz: 21e956e1ddfcab3cf25a66cc72082890691aa3e14b9f3cd638831a3006b41b29cdfbe31417e9cb7ad28aa58f9a24b5efe5df76f2fdb6376e3d823a7c150bdd85
7
+ data.tar.gz: 87141f753df9b55fceb2e9b34e741a36672b3ca5c1f07bfda1be597fdea978723bc7e03d7ab22da91af1168ad38c7951fa4c2135a8800a211828c93986cf0c39
@@ -1,3 +1,3 @@
1
1
  class DatesFromString
2
- VERSION = "0.7.0"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -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 string =~ (/\d{4}-\d{4}/)
100
- string.split("-")
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dates_from_string
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Chechaev