Class: MountableImageServer::ImageLocator
- Inherits:
-
Object
- Object
- MountableImageServer::ImageLocator
- Defined in:
- lib/mountable_image_server/image_locator.rb
Instance Method Summary collapse
-
#initialize(sources) ⇒ ImageLocator
constructor
A new instance of ImageLocator.
- #path_for(filename) ⇒ Object
Constructor Details
#initialize(sources) ⇒ ImageLocator
Returns a new instance of ImageLocator.
5 6 7 |
# File 'lib/mountable_image_server/image_locator.rb', line 5 def initialize(sources) @sources = sources end |
Instance Method Details
#path_for(filename) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# 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 |