class Tilia::VObject::Property::ICalendar::Duration

Duration property.

This object represents DURATION values, as defined here:

tools.ietf.org/html/rfc5545#section-3.3.6

Attributes

delimiter[RW]

In case this is a multi-value property. This string will be used as a delimiter.

@return [String, nil]

Public Class Methods

new(*args) click to toggle source
Calls superclass method Tilia::VObject::Property::new
# File lib/tilia/v_object/property/i_calendar/duration.rb, line 57
def initialize(*args)
  super(*args)
  @delimiter = ','
end

Public Instance Methods

date_interval() click to toggle source

Returns a DateInterval representation of the Duration property.

If the property has more than one value, only the first is returned.

@return [DateInterval]

# File lib/tilia/v_object/property/i_calendar/duration.rb, line 51
def date_interval
  parts = self.parts
  value = parts[0]
  DateTimeParser.parse_duration(value)
end
raw_mime_dir_value() click to toggle source

Returns a raw mime-dir representation of the value.

@return [String]

# File lib/tilia/v_object/property/i_calendar/duration.rb, line 32
def raw_mime_dir_value
  parts.join(@delimiter)
end
raw_mime_dir_value=(val) click to toggle source

Sets a raw value coming from a mimedir (iCalendar/vCard) file.

This has been 'unfolded', so only 1 line will be passed. Unescaping is not yet done, but parameters are not included.

@param [String] val

@return [void]

# File lib/tilia/v_object/property/i_calendar/duration.rb, line 25
def raw_mime_dir_value=(val)
  self.value = val.split(@delimiter)
end
value_type() click to toggle source

Returns the type of value.

This corresponds to the VALUE= parameter. Every property also has a 'default' valueType.

@return [String]

# File lib/tilia/v_object/property/i_calendar/duration.rb, line 42
def value_type
  'DURATION'
end