class Icalendar::Values::Period
Constants
- PERIOD_LAST_PART_REGEX
Public Class Methods
new(value, params = {})
click to toggle source
Calls superclass method
Icalendar::Value::new
# File lib/icalendar/values/period.rb, line 10 def initialize(value, params = {}) parts = value.split '/' period_start = Icalendar::Values::DateTime.new parts.first if parts.last =~ PERIOD_LAST_PART_REGEX period_end = Icalendar::Values::Duration.new parts.last else period_end = Icalendar::Values::DateTime.new parts.last end super [period_start, period_end], params end
Public Instance Methods
duration()
click to toggle source
# File lib/icalendar/values/period.rb, line 41 def duration last.is_a?(Icalendar::Values::Duration) ? last : nil end
duration=(v)
click to toggle source
# File lib/icalendar/values/period.rb, line 45 def duration=(v) value[1] = v.is_a?(Icalendar::Values::Duration) ? v : Icalendar::Values::Duration.new(v) end
explicit_end()
click to toggle source
# File lib/icalendar/values/period.rb, line 33 def explicit_end last.is_a?(Icalendar::Values::DateTime) ? last : nil end
explicit_end=(v)
click to toggle source
# File lib/icalendar/values/period.rb, line 37 def explicit_end=(v) value[1] = v.is_a?(Icalendar::Values::DateTime) ? v : Icalendar::Values::DateTime.new(v) end
period_start()
click to toggle source
# File lib/icalendar/values/period.rb, line 25 def period_start first end
period_start=(v)
click to toggle source
# File lib/icalendar/values/period.rb, line 29 def period_start=(v) value[0] = v.is_a?(Icalendar::Values::DateTime) ? v : Icalendar::Values::DateTime.new(v) end
value_ical()
click to toggle source
# File lib/icalendar/values/period.rb, line 21 def value_ical value.map { |v| v.value_ical }.join '/' end