Class: ROF::Filters::FileToUrl
- Inherits:
-
ROF::Filter
- Object
- ROF::Filter
- ROF::Filters::FileToUrl
- Defined in:
- lib/rof/filters/file_to_url.rb
Overview
Convert any content datastream files into a bendo URL, and alter the rof to use the URL and not upload the file to fedora directly. The bendo URL will only exist for items having a bendo-item id set. The URL generated supposes the file keeps the same relative path the item originally had in the rof file.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ FileToUrl
constructor
A new instance of FileToUrl.
- #process(obj_list) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ FileToUrl
Returns a new instance of FileToUrl.
11 12 |
# File 'lib/rof/filters/file_to_url.rb', line 11 def initialize( = {}) end |
Instance Method Details
#process(obj_list) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rof/filters/file_to_url.rb', line 14 def process(obj_list) obj_list.map! do |obj| bendo_item = obj['bendo-item'] content_file = obj['content-file'] if bendo_item && content_file = obj.fetch('content-meta', {}) ['URL'] = "bendo:/item/#{bendo_item}/#{content_file}" obj['content-meta'] = obj.delete('content-file') end obj end end |