Class: Dor::CollectionService
- Inherits:
-
Object
- Object
- Dor::CollectionService
- Defined in:
- lib/dor/services/collection_service.rb
Overview
Adds and removes collections to and from objects Collections are added as Compollections and Sets.
Instance Method Summary collapse
- #add(collection_or_druid) ⇒ Object
-
#initialize(obj) ⇒ CollectionService
constructor
A new instance of CollectionService.
- #remove(collection_or_druid) ⇒ Object
Constructor Details
#initialize(obj) ⇒ CollectionService
Returns a new instance of CollectionService.
7 8 9 |
# File 'lib/dor/services/collection_service.rb', line 7 def initialize(obj) @obj = obj end |
Instance Method Details
#add(collection_or_druid) ⇒ Object
11 12 13 14 15 |
# File 'lib/dor/services/collection_service.rb', line 11 def add(collection_or_druid) collection = dereference(collection_or_druid) obj.collections << collection obj.sets << collection end |
#remove(collection_or_druid) ⇒ Object
17 18 19 20 21 |
# File 'lib/dor/services/collection_service.rb', line 17 def remove(collection_or_druid) collection = dereference(collection_or_druid) obj.collections.delete(collection) obj.sets.delete(collection) end |