event_nlp 0.2.15 → 0.2.16
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/event_nlp.rb +24 -7
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9765f56a2cdca51484e63883fe5b1999074570b8
|
4
|
+
data.tar.gz: d9c5b776cdeaa3aa6ad915b4de05366073f16572
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb3dbed493d2946b933fa16d2bd8a94698bc4744ff6b094d01c5801d5aed720f391cb4f9b1fc4eb44e9df0a226035e515638e787eaed83b0941b9d0265ff84fc
|
7
|
+
data.tar.gz: 208d2d5aee1a109e1e2e546b29ccd10aa7ab931e307ec30720c366e16b204d013daf84951cadf833771ac5145eab3c6d0a0a70caf5a078fa3a543353d6ee326e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/event_nlp.rb
CHANGED
@@ -150,22 +150,39 @@ class EventNlp
|
|
150
150
|
#
|
151
151
|
get /^(.*)(every .*)/ do |title, recurring|
|
152
152
|
|
153
|
+
input = params[:input].clone
|
153
154
|
raw_start_date = recurring[/(?<=starting )[^\)]+/]
|
154
155
|
|
155
|
-
if raw_start_date then
|
156
|
+
d = if raw_start_date then
|
156
157
|
start_date = Chronic.parse(raw_start_date, now: @now - 1,
|
157
158
|
:endian_precedence => :little)
|
158
159
|
|
159
|
-
|
160
|
+
puts 'start_date: ' + start_date.inspect if @debug
|
161
|
+
|
162
|
+
if @now > start_date then
|
163
|
+
exp = ChronicCron.new(recurring, start_date).to_expression
|
164
|
+
puts 'exp: ' + exp.inspect if @debug
|
165
|
+
|
166
|
+
cf = CronFormat.new(exp, start_date)
|
167
|
+
puts cf.to_time if @debug
|
168
|
+
#cf.next until cf.to_time >= start_date
|
169
|
+
|
170
|
+
new_date = cf.to_time
|
171
|
+
input.gsub!(/(?<=starting )[^\)]+/, new_date\
|
172
|
+
.strftime("#{new_date.day.ordinal} %b %Y"))
|
173
|
+
new_date
|
174
|
+
|
175
|
+
else
|
176
|
+
start_date
|
177
|
+
end
|
160
178
|
|
161
|
-
cf = CronFormat.new(exp, start_date - 1)
|
162
|
-
#cf.next until cf.to_time >= start_date
|
163
179
|
else
|
164
180
|
exp = ChronicCron.new(recurring).to_expression
|
165
181
|
cf = CronFormat.new(exp, @now)
|
182
|
+
cf.to_time
|
166
183
|
end
|
167
184
|
|
168
|
-
|
185
|
+
|
169
186
|
|
170
187
|
if recurring =~ /-/ then
|
171
188
|
end_date = Chronic.parse d.to_date.to_s + ' ' +
|
@@ -173,7 +190,7 @@ class EventNlp
|
|
173
190
|
end
|
174
191
|
|
175
192
|
puts [0.5, title, recurring, d].inspect if @debug
|
176
|
-
{title: title.rstrip, recurring: recurring, date: d, end_date: end_date }
|
193
|
+
{input: input, title: title.rstrip, recurring: recurring, date: d, end_date: end_date }
|
177
194
|
|
178
195
|
end
|
179
196
|
|
@@ -341,4 +358,4 @@ class EventNlp
|
|
341
358
|
|
342
359
|
end
|
343
360
|
|
344
|
-
end
|
361
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_nlp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
/WtgKLMzCAKTHZ2OpN3OTs6j+vsUBIwCb/Ki17Z4YULtRaGg7I8nTjTrHIIJ0yNm
|
32
32
|
kbRihMTezaC+4A==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-
|
34
|
+
date: 2017-12-03 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: chronic_cron
|
metadata.gz.sig
CHANGED
Binary file
|