public
Fork of mojombo/chronic
Description: Chronic is a pure Ruby natural language date parser.
Homepage: http://chronic.rubyforge.org
Clone URL: git://github.com/technoweenie/chronic.git
removed verbose error checking output
mojombo (author)
Fri Oct 20 14:34:20 -0700 2006
commit  2929d1069221911b0f623eb67ffc5fbdec569930
tree    d665b0a69608756ccb37ec4e70e30d25bc38d06e
parent  89360d9d922a80525f9e4443208583b0cc2255cc
...
 
 
 
1
2
3
...
1
2
3
4
5
6
0
@@ -1,3 +1,6 @@
0
+0.1.4
0
+ * removed verbose error checking code. oops. :-/
0
+
0
 0.1.3
0
   * improved regexes for word variations (Josh Goebel)
0
   * fixed a bug that caused "today at 3am" to return nil if current time is
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,7 +2,7 @@ require 'rubygems'
0
 
0
 SPEC = Gem::Specification.new do |s|
0
   s.name = 'chronic'
0
- s.version = '0.1.3'
0
+ s.version = '0.1.4'
0
   s.author = 'Tom Preston-Werner'
0
   s.email = 'tom@rubyisawesome.com'
0
   s.homepage = 'http://chronic.rubyforge.org'
...
34
35
36
37
38
 
39
40
41
42
...
34
35
36
 
 
37
38
39
 
 
0
@@ -34,9 +34,6 @@ require 'chronic/ordinal'
0
 require 'chronic/separator'
0
 
0
 module Chronic
0
- @version = "0.1.3"
0
- def self.debug=(val); @debug = val; end
0
+ def self.debug; false; end
0
 end
0
 
0
-Chronic.debug = true
0
-
...
73
74
75
76
 
77
78
79
...
73
74
75
 
76
77
78
79
0
@@ -73,7 +73,7 @@ module Chronic
0
       # strip any non-tagged tokens
0
       @tokens = @tokens.select { |token| token.tagged? }
0
       
0
- if true
0
+ if Chronic.debug
0
         puts "+---------------------------------------------------"
0
         puts "| " + @tokens.to_s
0
         puts "+---------------------------------------------------"
...
35
36
37
38
39
40
41
...
68
69
70
71
72
73
74
...
289
290
291
292
293
294
295
296
297
298
...
302
303
304
305
 
306
307
308
...
320
321
322
323
 
324
325
326
...
35
36
37
 
38
39
40
...
67
68
69
 
70
71
72
...
287
288
289
 
 
290
 
291
292
293
...
297
298
299
 
300
301
302
303
...
315
316
317
 
318
319
320
321
0
@@ -35,7 +35,6 @@ module Chronic
0
       self.definitions[:date].each do |handler|
0
         if handler.match(tokens, self.definitions)
0
           good_tokens = tokens.select { |o| !o.get_tag Separator }
0
- puts "--#{handler}"
0
           return self.send(handler.handler_method, good_tokens, options)
0
         end
0
       end
0
@@ -68,7 +67,6 @@ module Chronic
0
       end
0
       
0
       # I guess you're out of luck!
0
- puts "--SUCKY"
0
       return nil
0
     end
0
     
0
@@ -289,10 +287,7 @@ module Chronic
0
         when :last
0
           outer_span = head.next(:past)
0
         when :this
0
- puts "--THIS"
0
- puts "--#{repeaters}"
0
           if repeaters.size > 0
0
- puts "--NONE"
0
             outer_span = head.this(:none)
0
           else
0
             outer_span = head.this(options[:context])
0
@@ -302,7 +297,7 @@ module Chronic
0
         else raise(ChronicPain, "Invalid grabber")
0
       end
0
       
0
- puts "--#{outer_span}"
0
+ puts "--#{outer_span}" if Chronic.debug
0
       anchor = find_within(repeaters, outer_span, pointer)
0
     end
0
     
0
@@ -320,7 +315,7 @@ module Chronic
0
     # Returns a Span representing the innermost time span
0
     # or nil if no repeater union could be found
0
     def find_within(tags, span, pointer) #:nodoc:
0
- puts "--#{span}"
0
+ puts "--#{span}" if Chronic.debug
0
       return span if tags.empty?
0
       
0
       head, *rest = tags
...
7
8
9
10
11
12
13
...
7
8
9
 
10
11
12
0
@@ -7,7 +7,6 @@ class TestParsing < Test::Unit::TestCase
0
     # Wed Aug 16 14:00:00 UTC 2006
0
     @time_2006_08_16_14_00_00 = Time.local(2006, 8, 16, 14, 0, 0, 0)
0
     @time_2006_08_16_03_00_00 = Time.local(2006, 8, 16, 3, 0, 0, 0)
0
- Chronic.debug = false
0
   end
0
   
0
   def test__parse_guess_dates

Comments

    No one has commented yet.