Sha256: b2d60b47ee2a70c5c3f2de07ad0bcf8009395d7ef71bbc7ec5212ab0babec6a2
Contents?: true
Size: 1.2 KB
Versions: 5
Compression:
Stored size: 1.2 KB
Contents
## # @see https://github.com/samvera/hyrax/wiki/Hyrax's-Event-Bus-(Hyrax::Publisher) # @see https://www.rubydoc.info/gems/hyrax/Hyrax/Publisher # @see https://dry-rb.org/gems/dry-events module IiifPrint class Listener ## # Responsible for conditionally enqueuing the creation of child works from a PDF. # # @param event [#[]] a hash like construct with keys :user and :file_set # @param service [#conditionally_enqueue] # # @see Hyrax::WorkUploadsHandler def on_file_characterized(event, service: IiifPrint::SplitPdfs::ChildWorkCreationFromPdfService) file_set = event[:file_set] return false unless file_set return false unless file_set.file_set? return false unless file_set.original_file&.pdf? work = IiifPrint.parent_for(file_set) # A short-circuit to avoid fetching the underlying file. return false unless work user = work.depositor # TODO: Verify that this is the correct thing to be sending off for conditional enquing. That # will require a more involved integration test. file = file_set.original_file service.conditionally_enqueue(file_set: file_set, work: work, file: file, user: user) end end end
Version data entries
5 entries across 5 versions & 1 rubygems