Parent

Vpim::Icalendar::Vtodo

Public Class Methods

create(fields=[]) click to toggle source

Create a new Vtodo object.

If specified, fields must be either an array of Field objects to add, or a Hash of String names to values that will be used to build Field objects. The latter is a convenient short-cut allowing the Field objects to be created for you when called like:

Vtodo.create('SUMMARY' => "buy mangos")

TODO - maybe todos are usually created in a particular way? I can make it easier. Ideally, I would like to make it hard to encode an invalid Event.

# File lib/vpim/vtodo.rb, line 64
def Vtodo.create(fields=[])
  di = DirectoryInfo.create([], 'VTODO')

  Vpim::DirectoryInfo::Field.create_array(fields).each { |f| di.push_unique f }

  new(di.to_a)
end

Public Instance Methods

completed() click to toggle source

The date and time that a to-do was actually completed, a Time.

# File lib/vpim/vtodo.rb, line 87
def completed
  proptime 'COMPLETED'
end
due() click to toggle source

The time at which this Todo is due to be completed. If the DUE field is not present, but the DURATION field is, due will be calculated from DTSTART and DURATION.

# File lib/vpim/vtodo.rb, line 82
def due
  propend 'DUE'
end
duration() click to toggle source

The duration in seconds of a Todo, or nil if unspecified. If the DURATION field is not present, but the DUE field is, the duration is calculated from DTSTART and DUE. Durations of zero seconds are possible.

# File lib/vpim/vtodo.rb, line 76
def duration
  propduration 'DUE'
end
percent_complete() click to toggle source

The percentage completetion of the to-do, between 0 and 100. 0 means it hasn’t started, 100 that it has been completed.

TODO - the handling of this property isn’t tied to either COMPLETED: or STATUS:, but perhaps it should be?

# File lib/vpim/vtodo.rb, line 96
def percent_complete
  propinteger 'PERCENT-COMPLETE'
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.