Class: Sculd::Plan::Todo
- Inherits:
-
Sculd::Plan
- Object
- Sculd::Plan
- Sculd::Plan::Todo
- Defined in:
- lib/sculd/plan/todo.rb
Constant Summary collapse
- SYMBOL_CHAR =
"+"- DEFAULT_OPTION =
7
Constants inherited from Sculd::Plan
DEADLINE_PRIORITY, REMINDER_PRIORITY
Instance Attribute Summary
Attributes inherited from Sculd::Plan
#datetime, #description, #flag_time, #option
Instance Method Summary collapse
Methods inherited from Sculd::Plan
Constructor Details
This class inherits a constructor from Sculd::Plan
Instance Method Details
#event_dates ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/sculd/plan/todo.rb', line 32 def event_dates #@option ||= DEFAULT_OPTION results = [] results << @datetime results << @datetime + (@option || DEFAULT_OPTION) results.map do |datetime| Date.new(datetime.year, datetime.month, datetime.day) end end |
#priority(today) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sculd/plan/todo.rb', line 16 def priority(today) #@option = 1 if @option < 1 option = @option || DEFAULT_OPTION beginning = @datetime ending = @datetime + option if today < beginning return 0 elsif today <= ending rp = Sculd::Plan::REMINDER_PRIORITY dp = Sculd::Plan::DEADLINE_PRIORITY return (rp + (dp - rp) * (today - beginning)/(option.to_f)).to_i else return Sculd::Plan::DEADLINE_PRIORITY end end |