Class: TodoLint::DueDate
- Inherits:
-
Object
- Object
- TodoLint::DueDate
- Defined in:
- lib/todo_lint/due_date.rb
Overview
When is this todo actually due? When ought we be reminded of this one?
Constant Summary collapse
- DATE_PATTERN =
/(\d{4})-(\d{2})-(\d{2})/
- ANNOTATION_PATTERN =
/\(#{DATE_PATTERN}\)/
Instance Attribute Summary collapse
-
#to_date ⇒ Date
readonly
The actual date object when something is due.
Class Method Summary collapse
-
.from_annotation(date) ⇒ DueDate
Parse the date from the todo comment’s due date annotation.
-
.from_config_file(date) ⇒ DueDate
Parse the date from the todo_lint configuration file.
Instance Method Summary collapse
-
#initialize(date) ⇒ DueDate
constructor
Take a simple date object and imbue it with meaning.
-
#overdue? ⇒ Boolean
Is this due date in the past?.
Constructor Details
#initialize(date) ⇒ DueDate
Take a simple date object and imbue it with meaning
54 55 56 |
# File 'lib/todo_lint/due_date.rb', line 54 def initialize(date) @to_date = date end |
Instance Attribute Details
#to_date ⇒ Date (readonly)
The actual date object when something is due
48 49 50 |
# File 'lib/todo_lint/due_date.rb', line 48 def to_date @to_date end |
Class Method Details
.from_annotation(date) ⇒ DueDate
Parse the date from the todo comment’s due date annotation
25 26 27 |
# File 'lib/todo_lint/due_date.rb', line 25 def self.from_annotation(date) from_pattern(date, ANNOTATION_PATTERN) end |
.from_config_file(date) ⇒ DueDate
Parse the date from the todo_lint configuration file
15 16 17 |
# File 'lib/todo_lint/due_date.rb', line 15 def self.from_config_file(date) from_pattern(date, DATE_PATTERN) end |
Instance Method Details
#overdue? ⇒ Boolean
Is this due date in the past?
63 64 65 |
# File 'lib/todo_lint/due_date.rb', line 63 def overdue? Date.today > to_date end |