chronic 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
data/lib/chronic.rb
CHANGED
@@ -4,10 +4,14 @@ class Chronic::RepeaterDay < Chronic::Repeater #:nodoc:
|
|
4
4
|
def next(pointer)
|
5
5
|
super
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
if !@current_day_start
|
8
|
+
@current_day_start = Time.local(@now.year, @now.month, @now.day)
|
9
|
+
end
|
10
|
+
|
11
|
+
direction = pointer == :future ? 1 : -1
|
12
|
+
@current_day_start += direction * DAY_SECONDS
|
13
|
+
|
14
|
+
Chronic::Span.new(@current_day_start, @current_day_start + DAY_SECONDS)
|
11
15
|
end
|
12
16
|
|
13
17
|
def this(pointer = :future)
|
@@ -4,18 +4,22 @@ class Chronic::RepeaterDayName < Chronic::Repeater #:nodoc:
|
|
4
4
|
def next(pointer)
|
5
5
|
super
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
direction = pointer == :future ? 1 : -1
|
8
|
+
|
9
|
+
if !@current_day_start
|
10
|
+
@current_day_start = Time.local(@now.year, @now.month, @now.day)
|
11
|
+
@current_day_start += direction * DAY_SECONDS
|
12
|
+
|
10
13
|
day_num = symbol_to_number(@type)
|
11
|
-
|
12
|
-
|
14
|
+
|
15
|
+
while @current_day_start.wday != day_num
|
16
|
+
@current_day_start += direction * DAY_SECONDS
|
13
17
|
end
|
14
18
|
else
|
15
|
-
@
|
19
|
+
@current_day_start += direction * 7 * DAY_SECONDS
|
16
20
|
end
|
17
|
-
|
18
|
-
Chronic::Span.new(
|
21
|
+
|
22
|
+
Chronic::Span.new(@current_day_start, @current_day_start + DAY_SECONDS)
|
19
23
|
end
|
20
24
|
|
21
25
|
def this(pointer = :future)
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: chronic
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2006-09-
|
6
|
+
version: 0.1.2
|
7
|
+
date: 2006-09-16 00:00:00 -07:00
|
8
8
|
summary: A natural language date parser
|
9
9
|
require_paths:
|
10
10
|
- lib
|