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 +4 -4
- data/lib/pickup_line/parser.rb +6 -7
- data/lib/pickup_line/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: 302706c1ef67371cfb55292c3eb91442153a0bed
|
4
|
+
data.tar.gz: c715008bbf16d2ff0b38d32700ae3a40300b75f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef174886390cfe422ff2297fa25d1dfa1a66d0d9e725858fc359d608ad4bffae5f5c048a18b9d775d2eb534e56dac4a3344df829797ba1cfd97276b59e46543c
|
7
|
+
data.tar.gz: cdb342454debca3a68d83a68748105fa69a255dc90bc61b5618c724835e9ea96bac84809838c327bfe21c7dc3e947e7be04f99b1a0e3b61d8992c56edf84934c
|
data/lib/pickup_line/parser.rb
CHANGED
@@ -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('|')})(\
|
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
|
-
|
17
|
-
|
18
|
-
|
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
|
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?/
|
data/lib/pickup_line/version.rb
CHANGED
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
|
+
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:
|
11
|
+
date: 2014-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|