Class: Spotlight::CarrierwaveFileResolver

Inherits:
Riiif::AbstractFileSystemResolver
  • Object
show all
Defined in:
app/services/spotlight/carrierwave_file_resolver.rb

Overview

Used by RIIIF to find files uploaded by carrierwave

Instance Method Summary collapse

Constructor Details

#initializeCarrierwaveFileResolver

Override initialzer to avoid deprecation about not providing base path



7
8
9
# File 'app/services/spotlight/carrierwave_file_resolver.rb', line 7

def initialize
  # nop
end

Instance Method Details

#pattern(id) ⇒ Object

Raises:

  • (Riiif::ImageNotFoundError)


11
12
13
14
15
16
# File 'app/services/spotlight/carrierwave_file_resolver.rb', line 11

def pattern(id)
  uploaded_file = Spotlight::FeaturedImage.find(id).image.file
  raise Riiif::ImageNotFoundError, "unable to find file for #{id}" if uploaded_file.nil?

  uploaded_file.file
end