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

Instance Method Details

#initializerObject

Override initialzer to avoid deprecation about not providing base path



5
6
7
# File 'app/services/spotlight/carrierwave_file_resolver.rb', line 5

def initializer
  # nop
end

#pattern(id) ⇒ Object

Raises:

  • (Riiif::ImageNotFoundError)


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

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