chronic 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.md +4 -0
- data/lib/chronic.rb +1 -1
- data/lib/chronic/chronic.rb +23 -16
- metadata +2 -2
data/HISTORY.md
CHANGED
data/lib/chronic.rb
CHANGED
data/lib/chronic/chronic.rb
CHANGED
@@ -284,23 +284,30 @@ module Chronic
|
|
284
284
|
def tokens_to_span(tokens, options)
|
285
285
|
definitions = definitions(options)
|
286
286
|
|
287
|
-
definitions.each do |
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
287
|
+
(definitions[:date] + definitions[:endian]).each do |handler|
|
288
|
+
if handler.match(tokens, definitions)
|
289
|
+
good_tokens = tokens.select { |o| !o.get_tag Separator }
|
290
|
+
return handler.invoke(:date, good_tokens, options)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
definitions[:anchor].each do |handler|
|
295
|
+
if handler.match(tokens, definitions)
|
296
|
+
good_tokens = tokens.select { |o| !o.get_tag Separator }
|
297
|
+
return handler.invoke(:anchor, good_tokens, options)
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
definitions[:arrow].each do |handler|
|
302
|
+
if handler.match(tokens, definitions)
|
303
|
+
good_tokens = tokens.reject { |o| o.get_tag(SeparatorAt) || o.get_tag(SeparatorSlashOrDash) || o.get_tag(SeparatorComma) }
|
304
|
+
return handler.invoke(:arrow, good_tokens, options)
|
305
|
+
end
|
306
|
+
end
|
303
307
|
|
308
|
+
definitions[:narrow].each do |handler|
|
309
|
+
if handler.match(tokens, definitions)
|
310
|
+
return handler.invoke(:narrow, tokens, options)
|
304
311
|
end
|
305
312
|
end
|
306
313
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chronic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-21 00:00:00.000000000 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
description: Chronic is a natural language date/time parser written in pure Ruby.
|