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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45c0eb9a7954a200098e20e7b3742feab020fe85
4
- data.tar.gz: 961bacaf20e3f9bc0397bb80541cc1ff5dbbc3a7
3
+ metadata.gz: 606b26af2658058243012cf5cf12c26180bad1e8
4
+ data.tar.gz: be3f805b0a1ae07cf1b20431e1427bc831aeb815
5
5
  SHA512:
6
- metadata.gz: 3cf454320515e77ed6fd76e57bf66ea98e89eea0488c6f099455687929ff1bb5f2009c8bab01e0c33f3d12cda057ac5b8d68b47c92d6a446da68c5cc7a8f9423
7
- data.tar.gz: 24a8ff904de8d9f78e66e8cf2fda0dfde1bfa4b7aab6419813aff078e751d540e5cc090532fea1f4e87bc7ab7eee80292f97bb3205908ec4f36746195df9b070
6
+ metadata.gz: e065489960f57c71753ffb401e0158fd70b7ebb3cecf62cf996434c0d1730623f1331dbc04ed2ea83ac527e9733a02637e39f39a3f4788515e8fbc3e2db935b7
7
+ data.tar.gz: c7503ed813babf7e82db522efd9da358293fbd75e79a40e745b429b40fc22ee506bbc548ea689989a548efb7d46eba43162cc893f38cf8760fa2ac61eec58e3d
@@ -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
@@ -1,3 +1,3 @@
1
1
  module PickupLine
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -1,13 +1,20 @@
1
1
  require_relative '../lib/pickup_line'
2
2
 
3
- def thoughts(today, &block)
4
- describe "on #{today}" do
5
- block.call(Proc.new { |question, reference|
6
- it "should see '#{question}' as #{reference}" do
7
- d = PickupLine::Parser.new(today)
8
- ref = d.locate question
9
- ref.should == reference
10
- end
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.3
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-10-04 00:00:00.000000000 Z
11
+ date: 2013-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec