gnu-remind 0.1.4 → 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 +27 -10
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b779171299941272c40a69f2c88d4b34bc5fc85dc239a75ae0d9e8a7f8eccb4
4
- data.tar.gz: 44e7b58ad3a0ff1cae715438f216761eb345c0a2966da71a499e59b8998eef59
3
+ metadata.gz: c8302802a937430ef1ad975d6616ec60e3426f571ab67362f618396623184469
4
+ data.tar.gz: bab3dbb5c8cec7b55e84caa4e30bb7f31fccf60feb9ebfec9232c796d98cc438
5
5
  SHA512:
6
- metadata.gz: 633cadf0e0eec59b72bdd8611ed087329ad98f00ddb3bf92da7b81bb9b0748bef7c87b48c49de7798b293619c3429990374beab768ac0e8a48c0eb3e4d75b1ec
7
- data.tar.gz: 0d6a7e51f5236a36038ce5605a8332183cd1c145e05540feef9984e3106c8ceab6bd3babe712b9ae8548c525cbd7745d2daf69bca3dc43873eecdbb6a11f851a
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.4"
4
+ VERSION = "0.1.5"
5
5
  end
data/lib/remind.rb CHANGED
@@ -13,28 +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
39
  type: e.who,
32
- lead: 30
40
+ lead: 1
33
41
  }
34
- r[e.what].attr = h
35
- @@REM[e.what].attr = h
42
+ k = %[#{e.what} #{h[:type]} #{d}]
43
+ @@REM[k].attr = h
36
44
  end
37
45
  end
46
+ end
47
+
48
+ def self.remote x, u
49
+ r = REM[x]
50
+ r.clear!
51
+ Remind.rebuild!
38
52
  CAL.from_url(u).each do |e|
39
53
  d = e.when[:begin].to_time.localtime.strftime("%Y/%m/%d-%R")
40
54
  h = {
@@ -54,10 +68,13 @@ module Remind
54
68
  @@REM.to_rem!
55
69
  return nil
56
70
  end
71
+
57
72
  def self.[] k
58
73
  REM[k].agenda[1..-1]
59
74
  end
75
+
60
76
  def self.all
77
+ @@REM.to_rem!
61
78
  @@REM.agenda[1..-1]
62
79
  end
63
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.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Olson