class Dor::Etd

Public Instance Methods

etd_embargo_date() click to toggle source
# File lib/dor/models/etd.rb, line 91
def etd_embargo_date
  regaction = properties.regactiondttm.first
  embargo = properties.embargo.first
  if properties.regapproval.first =~ /^approved$/i &&
     !embargo.nil? && embargo != '' &&
     !regaction.nil? && regaction != ''
    embargo_months = case embargo
                     when /6 months/i
                       6
                     when /1 year/i
                       12
                     when /2 years/i
                       24
                     else
                       0
                     end
    return Time.strptime(regaction, '%m/%d/%Y %H:%M:%S') + embargo_months.months
  end
  nil
end