Class: Riiif::FileSystemFileResolver

Inherits:
AbstractFileSystemResolver show all
Defined in:
lib/riiif/file_system_file_resolver.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractFileSystemResolver

#base_path, #root

Instance Method Summary collapse

Methods inherited from AbstractFileSystemResolver

#find, #initialize, #path

Constructor Details

This class inherits a constructor from Riiif::AbstractFileSystemResolver

Instance Attribute Details

#input_types=(value) ⇒ Object

Sets the attribute input_types

Parameters:

  • value

    the value to set the attribute input_types to.



3
4
5
# File 'lib/riiif/file_system_file_resolver.rb', line 3

def input_types=(value)
  @input_types = value
end

Instance Method Details

#pattern(id) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
# File 'lib/riiif/file_system_file_resolver.rb', line 5

def pattern(id)
  raise ArgumentError, "Invalid characters in id `#{id}`" unless %r{^[\w\-:]+$}.match(id)
  ::File.join(base_path, "#{id}.{#{input_types.join(',')}}")
end