Class: Vpim::Icalendar::Vevent::Maker

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

Overview

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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(event) ⇒ Maker

:nodoc:



142
143
144
145
# File 'lib/vpim/vevent.rb', line 142

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

Instance Attribute Details

#eventObject (readonly)

The event that changes are being made to.



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

def event
  @event
end

Class Method Details

.make(event = Vpim::Icalendar::Vevent.create) {|m| ... } ⇒ Object

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

Yields:

  • (m)


149
150
151
152
153
# File 'lib/vpim/vevent.rb', line 149

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

Instance Method Details

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

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



167
168
169
170
171
172
173
174
# File 'lib/vpim/vevent.rb', line 167

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

#dtend(dtend) ⇒ Object

Set end for events with fixed durations. end can be a Date or Time



161
162
163
# File 'lib/vpim/vevent.rb', line 161

def dtend(dtend)
  set_date_or_datetime 'DTEND', 'DATE-TIME', dtend
end

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

Set the RRULE for this event. See #add_rrule



177
178
179
180
# File 'lib/vpim/vevent.rb', line 177

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::Vevent#transparency.



156
157
158
# File 'lib/vpim/vevent.rb', line 156

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