From 2929d1069221911b0f623eb67ffc5fbdec569930 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 20 Oct 2006 21:34:20 +0000 Subject: [PATCH] removed verbose error checking output --- CHANGELOG | 3 +++ chronic.gemspec | 2 +- lib/chronic.rb | 5 +---- lib/chronic/chronic.rb | 2 +- lib/chronic/handlers.rb | 9 ++------- test/test_parsing.rb | 1 - 6 files changed, 8 insertions(+), 14 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 397020c9..0d53004a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +0.1.4 + * removed verbose error checking code. oops. :-/ + 0.1.3 * improved regexes for word variations (Josh Goebel) * fixed a bug that caused "today at 3am" to return nil if current time is diff --git a/chronic.gemspec b/chronic.gemspec index 4ca70a28..c8ca14c4 100644 --- a/chronic.gemspec +++ b/chronic.gemspec @@ -2,7 +2,7 @@ require 'rubygems' SPEC = Gem::Specification.new do |s| s.name = 'chronic' - s.version = '0.1.3' + s.version = '0.1.4' s.author = 'Tom Preston-Werner' s.email = 'tom@rubyisawesome.com' s.homepage = 'http://chronic.rubyforge.org' diff --git a/lib/chronic.rb b/lib/chronic.rb index 8058ad32..b40fcee1 100644 --- a/lib/chronic.rb +++ b/lib/chronic.rb @@ -34,9 +34,6 @@ require 'chronic/separator' module Chronic - @version = "0.1.3" - def self.debug=(val); @debug = val; end + def self.debug; false; end end -Chronic.debug = true - diff --git a/lib/chronic/chronic.rb b/lib/chronic/chronic.rb index 180bce94..4d96da57 100644 --- a/lib/chronic/chronic.rb +++ b/lib/chronic/chronic.rb @@ -73,7 +73,7 @@ def parse(text, specified_options = {}) # strip any non-tagged tokens @tokens = @tokens.select { |token| token.tagged? } - if true + if Chronic.debug puts "+---------------------------------------------------" puts "| " + @tokens.to_s puts "+---------------------------------------------------" diff --git a/lib/chronic/handlers.rb b/lib/chronic/handlers.rb index 1beb4349..21e85d0e 100644 --- a/lib/chronic/handlers.rb +++ b/lib/chronic/handlers.rb @@ -35,7 +35,6 @@ def tokens_to_span(tokens, options) #:nodoc: self.definitions[:date].each do |handler| if handler.match(tokens, self.definitions) good_tokens = tokens.select { |o| !o.get_tag Separator } - puts "--#{handler}" return self.send(handler.handler_method, good_tokens, options) end end @@ -68,7 +67,6 @@ def tokens_to_span(tokens, options) #:nodoc: end # I guess you're out of luck! - puts "--SUCKY" return nil end @@ -289,10 +287,7 @@ def get_anchor(tokens, options) #:nodoc: when :last outer_span = head.next(:past) when :this - puts "--THIS" - puts "--#{repeaters}" if repeaters.size > 0 - puts "--NONE" outer_span = head.this(:none) else outer_span = head.this(options[:context]) @@ -302,7 +297,7 @@ def get_anchor(tokens, options) #:nodoc: else raise(ChronicPain, "Invalid grabber") end - puts "--#{outer_span}" + puts "--#{outer_span}" if Chronic.debug anchor = find_within(repeaters, outer_span, pointer) end @@ -320,7 +315,7 @@ def get_repeaters(tokens) #:nodoc: # Returns a Span representing the innermost time span # or nil if no repeater union could be found def find_within(tags, span, pointer) #:nodoc: - puts "--#{span}" + puts "--#{span}" if Chronic.debug return span if tags.empty? head, *rest = tags diff --git a/test/test_parsing.rb b/test/test_parsing.rb index 00733790..9ecd87a4 100644 --- a/test/test_parsing.rb +++ b/test/test_parsing.rb @@ -7,7 +7,6 @@ def setup # Wed Aug 16 14:00:00 UTC 2006 @time_2006_08_16_14_00_00 = Time.local(2006, 8, 16, 14, 0, 0, 0) @time_2006_08_16_03_00_00 = Time.local(2006, 8, 16, 3, 0, 0, 0) - Chronic.debug = false end def test__parse_guess_dates