class WarpEngine::Storage::LocalAdapter
The default storage adapter: files under file_container_path on the local disk. Paths resolving outside that directory count as missing.
Public Instance Methods
# File lib/warp_engine/storage.rb, line 27 def absolute_path(relative_path) base_path.join(relative_path.to_s) end
Returns relative_path joined onto base_path, without any check.
Source
# File lib/warp_engine/storage.rb, line 22 def base_path Pathname.new(WarpEngine.config.file_container_path) end
Returns the configured file_container_path as a Pathname.
Source
# File lib/warp_engine/storage.rb, line 38 def directory?(relative_path) path = absolute_path(relative_path) File.directory?(path) && inside_base?(path) end
Returns true when relative_path is a directory inside base_path.
Source
# File lib/warp_engine/storage.rb, line 32 def file?(relative_path) path = absolute_path(relative_path) File.file?(path) && inside_base?(path) end
Returns true when relative_path is a file inside base_path.
# File lib/warp_engine/storage.rb, line 45 def locate(relative_path, filename: nil, expires_in: nil) Location.file(absolute_path(relative_path).to_s) end
Returns a Location.file with the absolute path of relative_path; the filename and expires_in hints are ignored.