event_nlp 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d972a790cf8f12b7e4adf3c017cf3d9efa2c5b93ecd5b56f6586b3e4df08d59
4
- data.tar.gz: c4d11104ecefb85cf637dfcc9f7146494fab0263c64225719067a0c4b274212c
3
+ metadata.gz: b8f102397207d428e347bb308b05ec13a95816e3e6c6e8d83eab6d95ba50619f
4
+ data.tar.gz: 3c90203fe7a732e3877119b6986fbe63da8534555b692761f01ca50eed3ef52e
5
5
  SHA512:
6
- metadata.gz: 42c10bd659a54a757537a9a882603e92f25c5dfe1e077903ebd9086fa6dd7d580a8806801ae42ef7d72b78fb4c1a8507945cb3351b4e39e6c3b860b0ceb7b355
7
- data.tar.gz: 716474dcbe4691014bea9164d623746ca5cb6031174792c81c6fc2ec66fcc164869f04e1efea90793bd4f22b0420540498fea83b6f908b35aeac5bcfc0d2eae9
6
+ metadata.gz: ff2e3d465256a32fb5a03be23690f6a8115d5bf3045d59b621eb43dfc856d0efb018b4fcf8ed5fef766dc37f0a417607e02bd1ef2e25149be7e6b502a199af67
7
+ data.tar.gz: 2f1c21235b869ce0815b4f5881c3f15dec7a070adf29a162a956bc166fedb1176d062b3f7c14452b671fa4359245637800ba5877eca5f821b713f1809db86e18
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/event_nlp.rb CHANGED
@@ -70,7 +70,10 @@ class EventNlp
70
70
  get /(.*) on the (#{days}) of every (#{periods})/ do |title, day, recurring|
71
71
 
72
72
 
73
- d = Chronic.parse(day)
73
+ raw_d = Chronic.parse(day)
74
+
75
+ # if the date is less than now then increment it by a month
76
+ d = raw_d < @now ? (raw_d.to_date >> 1).to_time : raw_d
74
77
 
75
78
 
76
79
  if @debug then
@@ -386,6 +389,7 @@ class EventNlp
386
389
  end
387
390
 
388
391
  # hall 2 at 11am
392
+ #
389
393
  get /(.*)\s+at\s+(#{times})/i do |title, time|
390
394
 
391
395
  d = Chronic.parse(time)
@@ -396,8 +400,33 @@ class EventNlp
396
400
  end
397
401
 
398
402
 
399
- # Tuesday 3rd October gas service at Barbara's house morning 9am-1pm
403
+ # Council Tax on the last day of the month
404
+ #
405
+ get /^(.*) (?:o[nf] the)\s*last day of the month/i do |title|
406
+
407
+ td = @now.to_date
408
+ d = Date.civil(td.year, td.month, -1).to_time
409
+
410
+ puts [5, title].inspect if @debug
411
+ { title: title, date: d }
412
+
413
+ end
400
414
 
415
+ # Council Tax last day of the month
416
+ #
417
+ get /^(.*) +last day of the month/i do |title|
418
+
419
+ td = @now.to_date
420
+ d = Date.civil(td.year, td.month, -1).to_time
421
+
422
+ puts [5.1, title].inspect if @debug
423
+ { title: title, date: d }
424
+
425
+ end
426
+
427
+
428
+ # Tuesday 3rd October gas service at Barbara's house morning 9am-1pm
429
+ #
401
430
  get '*' do
402
431
 
403
432
  s = params[:input]
@@ -435,7 +464,7 @@ class EventNlp
435
464
  end
436
465
  end
437
466
 
438
- puts [5, title, raw_date, time1].inspect if @debug
467
+ puts [6, title, raw_date, time1].inspect if @debug
439
468
  { title: title, date: d, end_date: end_date, recurring: recurring }
440
469
  end
441
470
 
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.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  hfzP67fp+s/TI6Tk+IvaEWBcfX7AV2XjfhS+q3uCBvQRjmbbRg3JO4XdjAQI3q8d
31
31
  +P4=
32
32
  -----END CERTIFICATE-----
33
- date: 2018-08-19 00:00:00.000000000 Z
33
+ date: 2018-08-27 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: chronic_cron
metadata.gz.sig CHANGED
Binary file