chronic 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +2 -0
- data/lib/chronic.rb +1 -1
- data/lib/chronic/time_zone.rb +22 -0
- metadata +3 -1
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -26,6 +26,7 @@ lib/chronic/repeaters/repeater_weekend.rb
|
|
26
26
|
lib/chronic/repeaters/repeater_year.rb
|
27
27
|
lib/chronic/scalar.rb
|
28
28
|
lib/chronic/separator.rb
|
29
|
+
lib/chronic/time_zone.rb
|
29
30
|
lib/numerizer/numerizer.rb
|
30
31
|
test/suite.rb
|
31
32
|
test/test_Chronic.rb
|
@@ -41,5 +42,6 @@ test/test_RepeaterWeek.rb
|
|
41
42
|
test/test_RepeaterWeekend.rb
|
42
43
|
test/test_RepeaterYear.rb
|
43
44
|
test/test_Span.rb
|
45
|
+
test/test_Time.rb
|
44
46
|
test/test_Token.rb
|
45
47
|
test/test_parsing.rb
|
data/lib/chronic.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Chronic
|
2
|
+
class TimeZone < Tag #:nodoc:
|
3
|
+
def self.scan(tokens)
|
4
|
+
tokens.each_index do |i|
|
5
|
+
if t = self.scan_for_all(tokens[i]) then tokens[i].tag(t); next end
|
6
|
+
end
|
7
|
+
tokens
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.scan_for_all(token)
|
11
|
+
scanner = {/[PMCE][DS]T/i => :tz}
|
12
|
+
scanner.keys.each do |scanner_item|
|
13
|
+
return self.new(scanner[scanner_item]) if scanner_item =~ token.word
|
14
|
+
end
|
15
|
+
return nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
'timezone'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: chronic
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.2.
|
6
|
+
version: 0.2.2
|
7
7
|
date: 2007-04-21 00:00:00 -07:00
|
8
8
|
summary: A natural language date parser
|
9
9
|
require_paths:
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/chronic/repeaters/repeater_year.rb
|
58
58
|
- lib/chronic/scalar.rb
|
59
59
|
- lib/chronic/separator.rb
|
60
|
+
- lib/chronic/time_zone.rb
|
60
61
|
- lib/numerizer/numerizer.rb
|
61
62
|
- test/suite.rb
|
62
63
|
- test/test_Chronic.rb
|
@@ -72,6 +73,7 @@ files:
|
|
72
73
|
- test/test_RepeaterWeekend.rb
|
73
74
|
- test/test_RepeaterYear.rb
|
74
75
|
- test/test_Span.rb
|
76
|
+
- test/test_Time.rb
|
75
77
|
- test/test_Token.rb
|
76
78
|
- test/test_parsing.rb
|
77
79
|
test_files:
|