gnu-remind 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/remind/version.rb +1 -1
  3. data/lib/remind.rb +28 -10
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46e172556837650d117663d4dc02b9e3a12a40929da5ac8af29d6f8020f7628b
4
- data.tar.gz: 743ba42e615aec2ddd988784e94ff4130ab2446a8799e683fd3fd9c8cefb2e76
3
+ metadata.gz: c8302802a937430ef1ad975d6616ec60e3426f571ab67362f618396623184469
4
+ data.tar.gz: bab3dbb5c8cec7b55e84caa4e30bb7f31fccf60feb9ebfec9232c796d98cc438
5
5
  SHA512:
6
- metadata.gz: 4fd661422f0d7132ff199aba2f58480fa4f195f597d96a04000a05bfeea68ac1e99c68f01f657f0c83a0e18df08d323bf5a7db181672daf4adaf742f293cf06d
7
- data.tar.gz: 7a06720a9dcd705fe04b5f63e53f2bd60f28023c90565edf5fe025da9be8e071aa6892f8c75c5681ede735a60beb757351b2f8df7732cefb815038b26afc5653
6
+ metadata.gz: 432e323c67bb3b876db61bc967bb2dedabee7ff5ed2f73a3fce029f9c2f1efb00b28464c7ebf6d4a64827fa8345ce1da5b3163e81956cca1fb796c7c999b9921
7
+ data.tar.gz: f7757d9b561d015faa63880d888447739b2a6317e462cc1b65a9f794309e81ebe11f8ff45fba35b76b519ae4e0fa35fe9e0949ee1c687cf5440e8a3252d80927
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Remind
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.5"
5
5
  end
data/lib/remind.rb CHANGED
@@ -13,27 +13,42 @@ require_relative "remind/calendar"
13
13
  module Remind
14
14
  class Error < StandardError; end
15
15
  @@REM = REM['reminders']
16
- def self.make x, u, *i
17
- r = REM[x]
18
- r.clear!
16
+ @@INIT = []
17
+ @@URL = []
18
+ def self.init h={}
19
+ @@INIT << h
20
+ end
21
+
22
+ def self.url u
23
+ @@URL << u
24
+ end
25
+
26
+ def self.rebuild!
19
27
  @@REM.clear!
20
- [i].flatten.each do |x|
21
- r[x[:what]].attr = { date: x[:when] }
28
+ [@@INIT].flatten.each do |x|
22
29
  @@REM[x[:what]].attr = { date: x[:when] }
23
30
  end
24
- if ENV.has_key? 'ICS'
25
- CAL.from_url(ENV['ICS']).each do |e|
31
+ @@URL.each do |u|
32
+ CAL.from_url(u).each do |e|
33
+ d = e.when[:begin].to_time.localtime.strftime("%Y/%m/%d-%R")
26
34
  h = {
27
35
  date: e.when[:begin].to_time.localtime.strftime("%-d %b %Y"),
28
36
  hour: e.when[:begin].to_time.localtime.strftime("%k"),
29
37
  minute: e.when[:begin].to_time.localtime.strftime("%M"),
30
38
  at: e.where,
31
- type: e.who
39
+ type: e.who,
40
+ lead: 1
32
41
  }
33
- r[e.what].attr = h
34
- @@REM[e.what].attr = h
42
+ k = %[#{e.what} #{h[:type]} #{d}]
43
+ @@REM[k].attr = h
35
44
  end
36
45
  end
46
+ end
47
+
48
+ def self.remote x, u
49
+ r = REM[x]
50
+ r.clear!
51
+ Remind.rebuild!
37
52
  CAL.from_url(u).each do |e|
38
53
  d = e.when[:begin].to_time.localtime.strftime("%Y/%m/%d-%R")
39
54
  h = {
@@ -53,10 +68,13 @@ module Remind
53
68
  @@REM.to_rem!
54
69
  return nil
55
70
  end
71
+
56
72
  def self.[] k
57
73
  REM[k].agenda[1..-1]
58
74
  end
75
+
59
76
  def self.all
77
+ @@REM.to_rem!
60
78
  @@REM.agenda[1..-1]
61
79
  end
62
80
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnu-remind
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Olson