Created
March 22, 2015 20:38
-
-
Save quoideneuf/f8596249aaf344f82f44 to your computer and use it in GitHub Desktop.
DAO Title
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with 'dao' do | |
# new stuff, borrowed from daogrp in the ead_converter.rb file... | |
title = '' | |
ancestor(:resource, :archival_object ) { |ao| | |
title << ao.title | |
date_label = ao.dates && ao.dates.length > 0 ? | |
lambda {|date| | |
if date['expression'] | |
date['expression'] | |
elsif date['begin'] and date['end'] | |
"#{date['begin']} - #{date['end']}" | |
else | |
date['begin'] | |
end | |
}.call(ao.dates.first) : false | |
title += ", " if (title.length > 0) && date_label | |
title += date_label if date_label | |
} | |
make :instance, { | |
:instance_type => 'digital_object' | |
} do |instance| | |
set ancestor(:resource, :archival_object), :instances, instance | |
end | |
make :digital_object, { | |
:digital_object_id => SecureRandom.uuid, | |
# more new stuff... | |
:title => title, | |
} do |obj| | |
obj.file_versions << { | |
:use_statement => att('role'), | |
:file_uri => att('href'), | |
:xlink_actuate_attribute => att('actuate'), | |
:xlink_show_attribute => att('show') | |
} | |
set ancestor(:instance), :digital_object, obj | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment