Sha256: 3c768319c4cda6cd3d53262e602a92039477e79a80bc9a32fbb64ba736fe8656

Contents?: true

Size: 789 Bytes

Versions: 10

Compression:

Stored size: 789 Bytes

Contents

# For the case where the source file is a remote file, and we
# don't want to download the file locally, just return the
# file name or file path (or whatever we need to pass to the
# encoding service so that it can find the file).

module Hydra::Derivatives
  class RemoteSourceFile
    # Finds the file name of the remote source file.
    # @param [String, ActiveFedora::Base] object file name, or an object that has a method that will return the file name
    # @param [Hash] options
    # @option options [Symbol] :source a method that can be called on the object to retrieve the source file's name
    # @yield [String] the file name
    def self.call(object, options, &_block)
      source_name = options.fetch(:source, :to_s)
      yield(object.send(source_name))
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hydra-derivatives-3.7.0 lib/hydra/derivatives/services/remote_source_file.rb
hydra-derivatives-3.6.1 lib/hydra/derivatives/services/remote_source_file.rb
hydra-derivatives-3.6.0 lib/hydra/derivatives/services/remote_source_file.rb
hydra-derivatives-3.5.0 lib/hydra/derivatives/services/remote_source_file.rb
hydra-derivatives-3.4.2 lib/hydra/derivatives/services/remote_source_file.rb
hydra-derivatives-3.4.1 lib/hydra/derivatives/services/remote_source_file.rb
hydra-derivatives-3.4.0 lib/hydra/derivatives/services/remote_source_file.rb
hydra-derivatives-3.3.2 lib/hydra/derivatives/services/remote_source_file.rb
hydra-derivatives-3.3.1 lib/hydra/derivatives/services/remote_source_file.rb
hydra-derivatives-3.3.0 lib/hydra/derivatives/services/remote_source_file.rb