class Icalendar::Values::Time

Constants

FORMAT

Public Class Methods

new(value, params = {}) click to toggle source
Calls superclass method Icalendar::Values::TimeWithZone::new
# File lib/icalendar/values/time.rb, line 12
def initialize(value, params = {})
  if value.is_a? String
    params['tzid'] = 'UTC' if value.end_with? 'Z'
    super ::DateTime.strptime(value, FORMAT).to_time, params
  elsif value.respond_to? :to_time
    super value.to_time, params
  else
    super
  end
end

Public Instance Methods

value_ical() click to toggle source
# File lib/icalendar/values/time.rb, line 23
def value_ical
  if tz_utc
    "#{strftime FORMAT}Z"
  else
    strftime FORMAT
  end
end