Method: Longleaf::FilesystemStorageLocation#relativize
- Defined in:
- lib/longleaf/models/filesystem_storage_location.rb
#relativize(file_path) ⇒ Object
Get the file path relative to this location
44 45 46 47 48 49 50 |
# File 'lib/longleaf/models/filesystem_storage_location.rb', line 44 def relativize(file_path) return file_path if Pathname.new(file_path).relative? raise ArgumentError.new("Metadata path must be contained by this location") if !file_path.start_with?(@path) file_path.sub(@path, "") end |