lib/remind.rb in gnu-remind-0.1.2 vs lib/remind.rb in gnu-remind-0.1.3
- old
+ new
@@ -11,23 +11,44 @@
require_relative "remind/calendar"
module Remind
class Error < StandardError; end
@@REM = REM['reminders']
- def self.[]= x, u
+ def self.make x, u, *i
r = REM[x]
r.clear!
@@REM.clear!
+ [i].flatten.each do |x|
+ r[x[:what]].attr = { date: x[:when] }
+ @@REM[x[:what]].attr = { date: x[:when] }
+ end
+ if ENV.has_key? 'ICS'
+ CAL.from_url(ENV['ICS']).each do |e|
+ h = {
+ date: e.when[:begin].to_time.localtime.strftime("%-d %b %Y"),
+ hour: e.when[:begin].to_time.localtime.strftime("%k"),
+ minute: e.when[:begin].to_time.localtime.strftime("%M"),
+ at: e.where,
+ type: e.who
+ }
+ r[e.what].attr = h
+ @@REM[e.what].attr = h
+ end
+ end
CAL.from_url(u).each do |e|
+ d = e.when[:begin].to_time.localtime.strftime("%Y/%m/%d-%R")
h = {
date: e.when[:begin].to_time.localtime.strftime("%-d %b %Y"),
hour: e.when[:begin].to_time.localtime.strftime("%k"),
minute: e.when[:begin].to_time.localtime.strftime("%M"),
at: e.where,
type: e.who
}
- r[e.what].attr = h
- @@REM[e.what].attr = h
+
+ k = %[#{e.what} #{h[:type]} #{d}]
+ puts "#{k}: #{h}"
+ r[k].attr = h
+ @@REM[k].attr = h
end
r.to_rem!
@@REM.to_rem!
return nil
end