chronic 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chronic.rb +1 -4
- data/lib/chronic/chronic.rb +1 -1
- data/lib/chronic/handlers.rb +2 -7
- data/test/test_parsing.rb +0 -1
- metadata +1 -1
data/lib/chronic.rb
CHANGED
data/lib/chronic/chronic.rb
CHANGED
@@ -73,7 +73,7 @@ module Chronic
|
|
73
73
|
# strip any non-tagged tokens
|
74
74
|
@tokens = @tokens.select { |token| token.tagged? }
|
75
75
|
|
76
|
-
if
|
76
|
+
if Chronic.debug
|
77
77
|
puts "+---------------------------------------------------"
|
78
78
|
puts "| " + @tokens.to_s
|
79
79
|
puts "+---------------------------------------------------"
|
data/lib/chronic/handlers.rb
CHANGED
@@ -35,7 +35,6 @@ module Chronic
|
|
35
35
|
self.definitions[:date].each do |handler|
|
36
36
|
if handler.match(tokens, self.definitions)
|
37
37
|
good_tokens = tokens.select { |o| !o.get_tag Separator }
|
38
|
-
puts "--#{handler}"
|
39
38
|
return self.send(handler.handler_method, good_tokens, options)
|
40
39
|
end
|
41
40
|
end
|
@@ -68,7 +67,6 @@ module Chronic
|
|
68
67
|
end
|
69
68
|
|
70
69
|
# I guess you're out of luck!
|
71
|
-
puts "--SUCKY"
|
72
70
|
return nil
|
73
71
|
end
|
74
72
|
|
@@ -289,10 +287,7 @@ module Chronic
|
|
289
287
|
when :last
|
290
288
|
outer_span = head.next(:past)
|
291
289
|
when :this
|
292
|
-
puts "--THIS"
|
293
|
-
puts "--#{repeaters}"
|
294
290
|
if repeaters.size > 0
|
295
|
-
puts "--NONE"
|
296
291
|
outer_span = head.this(:none)
|
297
292
|
else
|
298
293
|
outer_span = head.this(options[:context])
|
@@ -302,7 +297,7 @@ module Chronic
|
|
302
297
|
else raise(ChronicPain, "Invalid grabber")
|
303
298
|
end
|
304
299
|
|
305
|
-
puts "--#{outer_span}"
|
300
|
+
puts "--#{outer_span}" if Chronic.debug
|
306
301
|
anchor = find_within(repeaters, outer_span, pointer)
|
307
302
|
end
|
308
303
|
|
@@ -320,7 +315,7 @@ module Chronic
|
|
320
315
|
# Returns a Span representing the innermost time span
|
321
316
|
# or nil if no repeater union could be found
|
322
317
|
def find_within(tags, span, pointer) #:nodoc:
|
323
|
-
puts "--#{span}"
|
318
|
+
puts "--#{span}" if Chronic.debug
|
324
319
|
return span if tags.empty?
|
325
320
|
|
326
321
|
head, *rest = tags
|
data/test/test_parsing.rb
CHANGED
@@ -7,7 +7,6 @@ class TestParsing < Test::Unit::TestCase
|
|
7
7
|
# Wed Aug 16 14:00:00 UTC 2006
|
8
8
|
@time_2006_08_16_14_00_00 = Time.local(2006, 8, 16, 14, 0, 0, 0)
|
9
9
|
@time_2006_08_16_03_00_00 = Time.local(2006, 8, 16, 3, 0, 0, 0)
|
10
|
-
Chronic.debug = false
|
11
10
|
end
|
12
11
|
|
13
12
|
def test__parse_guess_dates
|