Skip to content

Commit

Permalink
Refactor Task#done?
Browse files Browse the repository at this point in the history
  • Loading branch information
spap committed Nov 12, 2013
1 parent 4a0a531 commit 2b945a0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/todo-txt/task.rb
Expand Up @@ -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
Expand Down Expand Up @@ -170,7 +169,7 @@ def overdue?
# task.done?
# #=> false
def done?
@done
!@completed_on.nil?
end

# Completes the task on the current date.
Expand All @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 2b945a0

Please sign in to comment.