class TodoNotifier

Attributes

tl[RW]

Public Class Methods

new() click to toggle source
# File lib/todoNotifier.rb, line 15
def initialize()
  self.tl = TaskList.new
end

Public Instance Methods

inRange(a, b, r) click to toggle source
# File lib/todoNotifier.rb, line 11
def inRange(a, b, r)
  (((a.to_time - r).to_datetime < b) && ((a.to_time + r).to_datetime > b))
end
update() click to toggle source
# File lib/todoNotifier.rb, line 19
def update()
  if self.tl.tasks[0]._d != nil
    if inRange(self.tl.tasks[0]._d, DateTime.now, 60)
      self.tl.tasks[0].notify()
      self.tl.tasks.shift
    end
  end
  sleep 60
end