class Icalendar::Values::Date

Constants

FORMAT

Public Class Methods

new(value, params = {}) click to toggle source
Calls superclass method Icalendar::Value.new
# File lib/icalendar/values/date.rb, line 9
def initialize(value, params = {})
  if value.is_a? String
    super ::Date.strptime(value, FORMAT), params
  elsif value.respond_to? :to_date
    super value.to_date, params
  else
    super
  end
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/icalendar/values/date.rb, line 23
def <=>(other)
  if other.is_a?(Icalendar::Values::Date) || other.is_a?(Icalendar::Values::DateTime)
    value_ical <=> other.value_ical
  else
    nil
  end
end
value_ical() click to toggle source
# File lib/icalendar/values/date.rb, line 19
def value_ical
  value.strftime FORMAT
end