class ROBundle::RODir

The managed .ro directory entry of a Research Object.

For internal use only.

Public Class Methods

new(manifest) click to toggle source

Create a new .ro managed directory entry with the specified manifest file object.

Calls superclass method
   # File lib/ro-bundle/ro/directory.rb
24 def initialize(manifest)
25   @manifest = manifest
26   @annotations_directory = AnnotationsDir.new
27 
28   super(DIR_NAME, :required => true,
29     :entries => [@manifest, @annotations_directory])
30 end

Private Instance Methods

mk_annotations_dir() click to toggle source
   # File lib/ro-bundle/ro/directory.rb
81 def mk_annotations_dir
82   dir_name = "#{full_name}/#{@annotations_directory.name}"
83   if container.find_entry(dir_name, :include_hidden => true).nil?
84     container.mkdir dir_name
85   end
86 end
normalize_content_name(name) click to toggle source

Convert an annotation content field into something compatible with the rubyzip file naming convention (i.e. full paths not prefixed with /).

    # File lib/ro-bundle/ro/directory.rb
 90 def normalize_content_name(name)
 91   return if name.nil?
 92 
 93   if name.start_with?(@annotations_directory.name)
 94     "#{full_name}/#{name}"
 95   elsif name.start_with?("/#{@annotations_directory.full_name}")
 96     name.slice(1, name.length)
 97   else
 98     nil
 99   end
100 end