class Icalendar::Values::DateOrDateTime

DateOrDateTime can be used to set an attribute to either a Date or a DateTime value. It should not be used without also invoking the ‘call` method.

Public Instance Methods

call() click to toggle source
# File lib/icalendar/values/date_or_date_time.rb, line 8
def call
  parsed
end
params_ical() click to toggle source
# File lib/icalendar/values/date_or_date_time.rb, line 16
def params_ical
  parsed.params_ical
end
value_ical() click to toggle source
# File lib/icalendar/values/date_or_date_time.rb, line 12
def value_ical
  parsed.value_ical
end

Private Instance Methods

needs_value_type?(default_type) click to toggle source
# File lib/icalendar/values/date_or_date_time.rb, line 30
def needs_value_type?(default_type)
  parsed.class != default_type
end
parsed() click to toggle source
# File lib/icalendar/values/date_or_date_time.rb, line 22
def parsed
  @parsed ||= begin
                Icalendar::Values::DateTime.new value, ical_params
              rescue Icalendar::Values::DateTime::FormatError
                Icalendar::Values::Date.new value, ical_params
              end
end
value_type() click to toggle source
# File lib/icalendar/values/date_or_date_time.rb, line 34
def value_type
  parsed.class.value_type
end