pickup_line 0.0.3 → 0.0.4
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 +7 -0
- data/lib/pickup_line/version.rb +1 -1
- data/spec/spec_helper.rb +16 -9
- 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: 606b26af2658058243012cf5cf12c26180bad1e8
|
4
|
+
data.tar.gz: be3f805b0a1ae07cf1b20431e1427bc831aeb815
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e065489960f57c71753ffb401e0158fd70b7ebb3cecf62cf996434c0d1730623f1331dbc04ed2ea83ac527e9733a02637e39f39a3f4788515e8fbc3e2db935b7
|
7
|
+
data.tar.gz: c7503ed813babf7e82db522efd9da358293fbd75e79a40e745b429b40fc22ee506bbc548ea689989a548efb7d46eba43162cc893f38cf8760fa2ac61eec58e3d
|
data/lib/pickup_line/parser.rb
CHANGED
@@ -20,6 +20,13 @@ module PickupLine
|
|
20
20
|
month_num = Date::ABBR_MONTHNAMES.compact.map(&:downcase).index($1) + 1
|
21
21
|
day = $2 ? $2.to_i : -1
|
22
22
|
future_date day, month_num, @date.year
|
23
|
+
# (next) Day names
|
24
|
+
elsif str =~ /next\s+(#{Date::DAYNAMES.map(&:downcase).join('|')})/
|
25
|
+
dindex = Date::DAYNAMES.map(&:downcase).index $1
|
26
|
+
d = @date
|
27
|
+
d += 1 until d.wday == 0 # go to next week
|
28
|
+
d += 1 until d.wday == dindex
|
29
|
+
d
|
23
30
|
# Day names
|
24
31
|
elsif str =~ /(#{Date::DAYNAMES.map(&:downcase).join('|')})/
|
25
32
|
dindex = Date::DAYNAMES.map(&:downcase).index $1
|
data/lib/pickup_line/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,20 @@
|
|
1
1
|
require_relative '../lib/pickup_line'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
})
|
3
|
+
# The methods available in the think context
|
4
|
+
module ThoughtMethods
|
5
|
+
attr_accessor :pickup_parser
|
6
|
+
def think(question, reference)
|
7
|
+
parser = pickup_parser
|
8
|
+
it "should see '#{question}' as #{reference}" do
|
9
|
+
parser.locate(question).should == reference
|
10
|
+
end
|
12
11
|
end
|
13
12
|
end
|
13
|
+
|
14
|
+
# A context method
|
15
|
+
def thoughts_on(today, &block)
|
16
|
+
example_class = describe "on #{today}"
|
17
|
+
example_class.extend ThoughtMethods
|
18
|
+
example_class.pickup_parser = PickupLine::Parser.new(today)
|
19
|
+
example_class.class_eval(&block)
|
20
|
+
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
|
+
version: 0.0.4
|
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-
|
11
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|