123456789_123456789_123456789_123456789_123456789_

Module: RSS::Maker::SetupDefaultDate

Instance Method Summary

Instance Method Details

#_parse_date_if_needed(date_value) (private)

[ GitHub ]

  
# File 'lib/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 (private)

[ GitHub ]

  
# File 'lib/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