Class: TodoNotifier
- Inherits:
-
Object
- Object
- TodoNotifier
- Defined in:
- lib/todoNotifier.rb
Instance Attribute Summary collapse
-
#tl ⇒ Object
Returns the value of attribute tl.
Instance Method Summary collapse
-
#initialize ⇒ TodoNotifier
constructor
A new instance of TodoNotifier.
- #inRange(a, b, r) ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize ⇒ TodoNotifier
Returns a new instance of TodoNotifier.
15 16 17 |
# File 'lib/todoNotifier.rb', line 15 def initialize() self.tl = TaskList.new end |
Instance Attribute Details
#tl ⇒ Object
Returns the value of attribute tl.
10 11 12 |
# File 'lib/todoNotifier.rb', line 10 def tl @tl end |
Instance Method Details
#inRange(a, b, r) ⇒ Object
11 12 13 |
# 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 ⇒ Object
19 20 21 22 23 24 25 26 27 |
# 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 |