Sha256: e753aefbea2e28c24e8ed750e7c3ce4bfda1dbb0b21b64f4e0b08ef677431073
Contents?: true
Size: 622 Bytes
Versions: 14
Compression:
Stored size: 622 Bytes
Contents
module Riiif class AbstractFileSystemResolver attr_accessor :root, :base_path def initialize @root = ::File.expand_path(::File.join(::File.dirname(__FILE__), '../..')) @base_path = ::File.join(root, 'spec/samples') end def find(id) Riiif::File.new(path(id)) end # @param [String] id the id to resolve # @return the path of the file def path(id) search = pattern(id) Dir.glob(search).first || raise(ImageNotFoundError, search) end def pattern(_id) raise NotImplementedError, "Implement `pattern(id)' in the concrete class" end end end
Version data entries
14 entries across 14 versions & 1 rubygems