lib/sculd/plan/deadline.rb in sculd-0.0.3 vs lib/sculd/plan/deadline.rb in sculd-0.1.0
- old
+ new
@@ -1,19 +1,22 @@
#! /usr/bin/env ruby
# coding: utf-8
-require "sculd/event.rb"
-require "sculd/plan.rb"
+#require "sculd/event.rb"
+#require "sculd/plan.rb"
#
#
#
class Sculd::Plan::Deadline < Sculd::Plan
+ SYMBOL_CHAR = "!"
+ DEFAULT_OPTION = 7
+
def priority(today)
- @option = 1 if @option < 1
- beginning = @datetime - @option
+ #@option = 1 if @option < 1
+ beginning = @datetime - (@option || DEFAULT_OPTION)
if today < beginning
return 0
elsif today <= @datetime
rp = Sculd::Plan::REMINDER_PRIORITY
dp = Sculd::Plan::DEADLINE_PRIORITY
@@ -21,13 +24,17 @@
else
return Sculd::Plan::DEADLINE_PRIORITY
end
end
- def events
+ def event_dates
+ #@option ||= DEFAULT_OPTION
+
results = []
- results << Sculd::Event.new(@datetime - @option, @description)
- results << Sculd::Event.new(@datetime, @description)
- return results
+ results << @datetime - (@option || DEFAULT_OPTION)
+ results << @datetime
+ results.map do |datetime|
+ Date.new(datetime.year, datetime.month, datetime.day)
+ end
end
end