class Vobject::Vcalendar::PropertyValue::Duration

Public Class Methods

new(val) click to toggle source
# File lib/vobject/vcalendar/propertyvalue.rb, line 352
def initialize(val)
  self.value = val
  self.type = "duration"
end

Public Instance Methods

to_hash() click to toggle source
# File lib/vobject/vcalendar/propertyvalue.rb, line 369
def to_hash
  value
end
to_s() click to toggle source
# File lib/vobject/vcalendar/propertyvalue.rb, line 357
def to_s
  ret = "P"
  ret = value[:sign] + ret if value[:sign]
  ret = ret + "#{value[:weeks]}W" if value[:weeks]
  ret = ret + "#{value[:days]}D" if value[:days]
  ret = ret + "T" if value[:hours] || value[:minutes] || value[:seconds]
  ret = ret + "#{value[:hours]}H" if value[:hours]
  ret = ret + "#{value[:minutes]}M" if value[:minutes]
  ret = ret + "#{value[:seconds]}S" if value[:seconds]
  ret
end