Class: Samvera::Derivatives::Hyrax::FileSetDerivativesServiceWrapper
- Inherits:
-
Object
- Object
- Samvera::Derivatives::Hyrax::FileSetDerivativesServiceWrapper
- Defined in:
- lib/samvera/derivatives/hyrax.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#file_set ⇒ Object
readonly
Returns the value of attribute file_set.
-
#wrapped_derivative_service ⇒ Object
readonly
Returns the value of attribute wrapped_derivative_service.
Instance Method Summary collapse
- #apply! ⇒ Object
-
#initialize(file_set:, file_path:) ⇒ FileSetDerivativesServiceWrapper
constructor
A new instance of FileSetDerivativesServiceWrapper.
- #present? ⇒ Boolean
Constructor Details
#initialize(file_set:, file_path:) ⇒ FileSetDerivativesServiceWrapper
Returns a new instance of FileSetDerivativesServiceWrapper.
83 84 85 86 87 |
# File 'lib/samvera/derivatives/hyrax.rb', line 83 def initialize(file_set:, file_path:) @file_set = file_set @file_path = file_path @wrapped_derivative_service = wrapped_derivative_service_class.new(file_set) end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
88 89 90 |
# File 'lib/samvera/derivatives/hyrax.rb', line 88 def file_path @file_path end |
#file_set ⇒ Object (readonly)
Returns the value of attribute file_set.
88 89 90 |
# File 'lib/samvera/derivatives/hyrax.rb', line 88 def file_set @file_set end |
#wrapped_derivative_service ⇒ Object (readonly)
Returns the value of attribute wrapped_derivative_service.
88 89 90 |
# File 'lib/samvera/derivatives/hyrax.rb', line 88 def wrapped_derivative_service @wrapped_derivative_service end |
Instance Method Details
#apply! ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/samvera/derivatives/hyrax.rb', line 96 def apply!(*) # Why the short-circuit? By the nature of the underlying # ::Hyrax::FileSetDerivativesService, we generate multiple derivatives in one pass. But # with the implementation of Samvera::Derivatives, we declare the derivatives and then # iterate on locating and applying them. With this short-circuit, we will only apply the # derivatives once. return true if defined?(@already_applied) return false unless wrapped_derivative_service.valid? wrapped_derivative_service.create_derivatives(file_path) @already_applied = true end |
#present? ⇒ Boolean
91 92 93 |
# File 'lib/samvera/derivatives/hyrax.rb', line 91 def present? true end |