Method: Moab::StorageRepository#storage_object

Defined in:
lib/moab/storage_repository.rb

#storage_object(object_id, create = false) ⇒ StorageObject

Returns The representation of a digitial object’s storage directory, which must exist.

Parameters:

  • object_id (String)

    The identifier of the digital object whose version is desired

  • create (Boolean) (defaults to: false)

    If true, the object home directory should be created if it does not exist

Returns:

  • (StorageObject)

    The representation of a digitial object’s storage directory, which must exist.



124
125
126
127
128
129
130
131
132
133
134
# File 'lib/moab/storage_repository.rb', line 124

def storage_object(object_id, create=false)
storage_object = find_storage_object(object_id)
unless storage_object.object_pathname.exist?
  if create
      storage_object.object_pathname.mkpath
    else
      raise Moab::ObjectNotFoundException, "No storage object found for #{object_id}"
  end
end
storage_object
end