Sha256: a0df790a5d55f23a52c48ff2a59671c4ba6266efb9ae2a9c089f83cec53a2ccb
Contents?: true
Size: 838 Bytes
Versions: 9
Compression:
Stored size: 838 Bytes
Contents
# frozen_string_literal: true # this class overrides the Valkyrie::Storage::Disk::BucketStorage class so that file paths match module Hyrax class DerivativeBucketedStorage attr_reader :base_path def initialize(base_path:) @base_path = base_path end # rubocop:disable Lint/UnusedMethodArgument def generate(resource:, file:, original_filename:) raise ArgumentError, "original_filename must be provided" unless original_filename Pathname.new(base_path).join(*bucketed_path(resource.id)).join(original_filename) end # rubocop:enable Lint/UnusedMethodArgument def bucketed_path(id) # We want to use the same code the derivative process uses so that items end up # stored in the place we expect them. Hyrax::DerivativePath.new(id.to_s).pair_directory end end end
Version data entries
9 entries across 9 versions & 1 rubygems