From 2b945a0fe133fd5efaa3b001b69b5b73e69891a5 Mon Sep 17 00:00:00 2001 From: Szabolcs Pap Date: Mon, 11 Nov 2013 23:44:20 -0500 Subject: [PATCH] Refactor Task#done? --- lib/todo-txt/task.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/todo-txt/task.rb b/lib/todo-txt/task.rb index 2df8ad1..6b9febd 100644 --- a/lib/todo-txt/task.rb +++ b/lib/todo-txt/task.rb @@ -45,7 +45,6 @@ def initialize task @orig = task @completed_on = get_completed_date #orig.scan(self.class.done_regex)[1] ||= nil @priority, @created_on = orig_priority, orig_created_on - @done = !@completed_on.nil? @contexts ||= orig.scan(self.class.contexts_regex).map { |item| item.strip } @projects ||= orig.scan(self.class.projects_regex).map { |item| item.strip } end @@ -170,7 +169,7 @@ def overdue? # task.done? # #=> false def done? - @done + !@completed_on.nil? end # Completes the task on the current date. @@ -189,7 +188,6 @@ def done? def do! @completed_on = Date.today @priority = nil - @done = true end # Marks the task as incomplete and resets its original due date. @@ -208,7 +206,6 @@ def do! def undo! @completed_on = nil @priority = orig_priority - @done = false end # Toggles the task from complete to incomplete or vice versa.