Class: Things::Todo
- Inherits:
-
Object
- Object
- Things::Todo
- Defined in:
- lib/teambox-things-sync.rb
Instance Attribute Summary collapse
-
#was_in_today ⇒ Object
Returns the value of attribute was_in_today.
Class Method Summary collapse
Instance Method Summary collapse
-
#move_to_today_if_necessary ⇒ Object
Moves todo to Today list if it’s due today or in the past, or user put it there manually.
- #remember_today_listing ⇒ Object
- #save ⇒ Object
Instance Attribute Details
#was_in_today ⇒ Object
Returns the value of attribute was_in_today.
23 24 25 |
# File 'lib/teambox-things-sync.rb', line 23 def was_in_today @was_in_today end |
Class Method Details
.find(name_or_id) ⇒ Object
38 39 40 41 42 |
# File 'lib/teambox-things-sync.rb', line 38 def self.find(name_or_id) todo = super todo.remember_today_listing if todo return todo end |
Instance Method Details
#move_to_today_if_necessary ⇒ Object
Moves todo to Today list if it’s due today or in the past, or user put it there manually
27 28 29 30 31 32 |
# File 'lib/teambox-things-sync.rb', line 27 def move_to_today_if_necessary tomorrow_midnight = Time.parse((Date.today+1).to_s) if (self.due_date && self.due_date < tomorrow_midnight) || was_in_today self.move(Things::List.today) end end |
#remember_today_listing ⇒ Object
34 35 36 |
# File 'lib/teambox-things-sync.rb', line 34 def remember_today_listing @was_in_today = Things::Todo.today.any? {|t| t.name == self.name} end |
#save ⇒ Object
44 45 46 47 48 |
# File 'lib/teambox-things-sync.rb', line 44 def save todo = super todo.move_to_today_if_necessary if todo return todo end |