class MountableImageServer::ImageLocator

Attributes

sources[R]

Public Class Methods

new(sources) click to toggle source
# File lib/mountable_image_server/image_locator.rb, line 5
def initialize(sources)
  @sources = sources
end

Public Instance Methods

path_for(filename) click to toggle source
# File lib/mountable_image_server/image_locator.rb, line 9
def path_for(filename)
  possible_paths = sources.map do |source|
    Pathname(source) + filename
  end

  possible_paths.detect do |path|
    path.exist?
  end
end