module RSS::Maker::SetupDefaultDate

Private Instance Methods

_parse_date_if_needed(date_value) click to toggle source
# File rss/maker/base.rb, line 375
def _parse_date_if_needed(date_value)
  date_value = Time.parse(date_value) if date_value.is_a?(String)
  date_value
end
_set_default_values() click to toggle source
Calls superclass method
# File rss/maker/base.rb, line 357
def _set_default_values
  keep = {
    :date => date,
    :dc_dates => dc_dates.to_a.dup,
  }
  _date = _parse_date_if_needed(date)
  if _date and !dc_dates.any? {|dc_date| dc_date.value == _date}
    dc_date = self.class::DublinCoreDates::DublinCoreDate.new(self)
    dc_date.value = _date.dup
    dc_dates.unshift(dc_date)
  end
  self.date ||= self.dc_date
  super
ensure
  self.date = keep[:date]
  dc_dates.replace(keep[:dc_dates])
end