Sha256: a4a49e685bf86ac35a76582b85f66b2cfc5dd061183068ed83ad6d44a7b4c6ea

Contents?: true

Size: 726 Bytes

Versions: 4

Compression:

Stored size: 726 Bytes

Contents

#! /usr/bin/env ruby
# coding: utf-8

require "sculd/event.rb"
require "sculd/plan.rb"

#
#
#
class Sculd::Plan::Todo < Sculd::Plan

  #
  def priority(today)
    @option = 1 if @option < 1
    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

  def events
    results = []
    results << Sculd::Event.new(@datetime, @description)
    results << Sculd::Event.new(@datetime + @option, @description)
    return results
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sculd-0.0.3 lib/sculd/plan/todo.rb
sculd-0.0.2 lib/sculd/plan/todo.rb
sculd-0.0.1 lib/sculd/plan/todo.rb
sculd-0.0.0 lib/sculd/plan/todo.rb