Module: Samvera::Derivatives::FileLocator
- Defined in:
- lib/samvera/derivatives.rb
Overview
Note:
Ideally, this module would be part of Hyrax or Hydra::Derivatives
The purpose of this module is to find the derivative file path for a FileSet and a given derivative type (e.g. :thumbnail).
Defined Under Namespace
Classes: Strategy
Class Method Summary collapse
-
.call(file_set:, file_path:, derivative:) ⇒ Samvera::Derivatives::FromLocation
This method is responsible for finding the correct file names for the given file set and derivative type.
Class Method Details
.call(file_set:, file_path:, derivative:) ⇒ Samvera::Derivatives::FromLocation
Note:
Why call? This allows for a simple lambda interface, which can greatly ease testing and composition.
This method is responsible for finding the correct file names for the given file set and derivative type.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/samvera/derivatives.rb', line 130 def self.call(file_set:, file_path:, derivative:) from_location = nil derivative.locators.each do |locator| from_location = locator.locate( file_set: file_set, file_path: file_path, derivative_type: derivative.type ) break if from_location.present? end from_location end |