Class: Dor::Etd

Inherits:
Abstract
  • Object
show all
Includes:
Embargoable
Defined in:
lib/dor/models/etd.rb

Instance Method Summary collapse

Methods included from Embargoable

#embargo_service, #embargoed?, #release_20_pct_vis_embargo, #release_embargo, #update_embargo

Methods inherited from Abstract

#adapt_to_cmodel, #add_collection, #allows_modification?, assign_pid, #current_version, #druid_regex, has_object_type, #pid_regex, #read_rights=, #reapply_admin_policy_object_defaults, #remove_collection, #remove_druid_prefix, #to_solr

Instance Method Details

#etd_embargo_dateObject



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/dor/models/etd.rb', line 79

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