pickup_line 0.0.4 → 0.0.5

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: 606b26af2658058243012cf5cf12c26180bad1e8
4
- data.tar.gz: be3f805b0a1ae07cf1b20431e1427bc831aeb815
3
+ metadata.gz: 302706c1ef67371cfb55292c3eb91442153a0bed
4
+ data.tar.gz: c715008bbf16d2ff0b38d32700ae3a40300b75f5
5
5
  SHA512:
6
- metadata.gz: e065489960f57c71753ffb401e0158fd70b7ebb3cecf62cf996434c0d1730623f1331dbc04ed2ea83ac527e9733a02637e39f39a3f4788515e8fbc3e2db935b7
7
- data.tar.gz: c7503ed813babf7e82db522efd9da358293fbd75e79a40e745b429b40fc22ee506bbc548ea689989a548efb7d46eba43162cc893f38cf8760fa2ac61eec58e3d
6
+ metadata.gz: ef174886390cfe422ff2297fa25d1dfa1a66d0d9e725858fc359d608ad4bffae5f5c048a18b9d775d2eb534e56dac4a3344df829797ba1cfd97276b59e46543c
7
+ data.tar.gz: cdb342454debca3a68d83a68748105fa69a255dc90bc61b5618c724835e9ea96bac84809838c327bfe21c7dc3e947e7be04f99b1a0e3b61d8992c56edf84934c
@@ -10,13 +10,12 @@ module PickupLine
10
10
  def locate(str)
11
11
  str = str.downcase
12
12
  words = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']
13
- # Full month names
14
- if str =~ /(#{Date::MONTHNAMES.compact.map(&:downcase).join('|')})(\s+\d+)?/
13
+ # Full month names with date
14
+ if str =~ /(#{Date::MONTHNAMES.compact.map(&:downcase).join('|')})\s+(\d{1,2})(?!\d)/
15
15
  month_num = Date::MONTHNAMES.compact.map(&:downcase).index($1) + 1
16
- day = $2 ? $2.to_i : -1
17
- future_date day, month_num, @date.year
18
- # Abbreviated month names
19
- elsif str =~ /(#{Date::ABBR_MONTHNAMES.compact.map(&:downcase).join('|')})\.?(\s+\d+)?/
16
+ future_date $2.to_i, month_num, @date.year
17
+ # Abbreviated month names with date
18
+ elsif str =~ /(#{Date::ABBR_MONTHNAMES.compact.map(&:downcase).join('|')})\.?\s+(\d{1,2})(?!\d)/
20
19
  month_num = Date::ABBR_MONTHNAMES.compact.map(&:downcase).index($1) + 1
21
20
  day = $2 ? $2.to_i : -1
22
21
  future_date day, month_num, @date.year
@@ -34,7 +33,7 @@ module PickupLine
34
33
  d += 1 until d.wday == dindex
35
34
  d
36
35
  # In N days
37
- elsif str =~ /in\s+(\d+)\s+days?/
36
+ elsif str =~ /in\s+(\d)\s+days?/
38
37
  @date + $1.to_i
39
38
  # In N days (with words)
40
39
  elsif str =~ /in\s+(#{words.join('|')})\s+days?/
@@ -1,3 +1,3 @@
1
1
  module PickupLine
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pickup_line
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Crepezzi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-04 00:00:00.000000000 Z
11
+ date: 2014-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec