Module: EtdModel::EtdHelper

Included in:
Etd
Defined in:
lib/etd_model/etd_helper.rb

Instance Method Summary collapse

Instance Method Details

#get_embargo_dateObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/etd_model/etd_helper.rb', line 3

def get_embargo_date
  props_ds = datastreams['properties']
  regaction = props_ds.regactiondttm.first
  embargo = props_ds.embargo.first
  if props_ds.regapproval.first =~ /^approved$/i &&
     !embargo.nil? && embargo != '' &&
     !regaction.nil? && regaction != ''
    case embargo
    when /6 months/i
      embargo_months = 6
    when /1 year/i
      embargo_months = 12
    when /2 years/i
      embargo_months = 24
    else
      embargo_months = 0
    end
    return Time.strptime(regaction, "%m/%d/%Y %H:%M:%S") + embargo_months.months
  end
  nil
end