Class: Hyrax::FileSetVisibilityPropagator
- Inherits:
-
Object
- Object
- Hyrax::FileSetVisibilityPropagator
- Defined in:
- app/services/hyrax/file_set_visibility_propagator.rb
Overview
Propagates visibility from a given Work to its FileSets
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(source:) ⇒ FileSetVisibilityPropagator
constructor
A new instance of FileSetVisibilityPropagator.
- #propagate ⇒ void
Constructor Details
#initialize(source:) ⇒ FileSetVisibilityPropagator
Returns a new instance of FileSetVisibilityPropagator.
14 15 16 |
# File 'app/services/hyrax/file_set_visibility_propagator.rb', line 14 def initialize(source:) self.source = source end |
Instance Attribute Details
#source ⇒ #visibility
10 11 12 |
# File 'app/services/hyrax/file_set_visibility_propagator.rb', line 10 def source @source end |
Instance Method Details
#propagate ⇒ void
This method returns an undefined value.
22 23 24 25 26 27 28 29 |
# File 'app/services/hyrax/file_set_visibility_propagator.rb', line 22 def propagate source.file_sets.each do |file| file.visibility = source.visibility # visibility must come first, because it can clear an embargo/lease copy_visibility_modifier(source: source, file: file, modifier: :lease) copy_visibility_modifier(source: source, file: file, modifier: :embargo) file.save! end end |