Class: Vpim::Icalendar::Vtodo::Maker

Inherits:
Object
  • Object
show all
Includes:
Set::Common, Set::Location, Set::Util
Defined in:
lib/vpim/vtodo.rb

Overview

Make a new Vtodo, or make changes to an existing Vtodo.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Set::Location

#location

Methods included from Set::Common

#access_class, #add_attendee, #categories, #comment, #created, #description, #dtstamp, #dtstart, #lastmod, #organizer, #sequence, #summary, #uid, #url

Methods included from Set::Util

#add_address, #field_create, #rm_all, #set_address, #set_date_or_datetime, #set_datetime, #set_integer, #set_text, #set_text_list, #set_token

Constructor Details

#initialize(todo) ⇒ Maker

:nodoc:



109
110
111
112
# File 'lib/vpim/vtodo.rb', line 109

def initialize(todo) #:nodoc:
  @todo = todo
  @comp = todo
end

Instance Attribute Details

#todoObject (readonly)

The todo that changes are being made to.



107
108
109
# File 'lib/vpim/vtodo.rb', line 107

def todo
  @todo
end

Class Method Details

.make(todo = Vpim::Icalendar::Vtodo.create) {|m| ... } ⇒ Object

Make changes to todo. If todo is not specified, creates a new todo. Yields a Vtodo::Maker, and returns todo.

Yields:

  • (m)


116
117
118
119
120
# File 'lib/vpim/vtodo.rb', line 116

def self.make(todo = Vpim::Icalendar::Vtodo.create) #:yield:maker
  m = self.new(todo)
  yield m
  m.todo
end

Instance Method Details

#add_rrule(rule = nil, &block) ⇒ Object

Add a RRULE to this todo. The rule can be provided as a pre-built RRULE value, or the RRULE maker can be used.



129
130
131
132
133
134
135
136
# File 'lib/vpim/vtodo.rb', line 129

def add_rrule(rule = nil, &block) #:yield: Rrule::Maker
  # TODO - should be in Property::Reccurrence::Set
  unless rule
    rule = Rrule::Maker.new(&block).encode
  end
  @comp.properties.push(Vpim::DirectoryInfo::Field.create("RRULE", rule))
  self
end

#set_rrule(rule = nil, &block) ⇒ Object

Set the RRULE for this todo. See #add_rrule



139
140
141
142
# File 'lib/vpim/vtodo.rb', line 139

def set_rrule(rule = nil, &block) #:yield: Rrule::Maker
  rm_all("RRULE")
  add_rrule(rule, &block)
end

#transparency(token) ⇒ Object

Set transparency to “OPAQUE” or “TRANSPARENT”, see Vpim::Vtodo#transparency.



123
124
125
# File 'lib/vpim/vtodo.rb', line 123

def transparency(token)
  set_token 'TRANSP', ["OPAQUE", "TRANSPARENT"], "OPAQUE", token
end