Sepia::PathResolver
Utility class for resolving file system paths to Sepia objects
This helper provides methods to convert file system paths back to Sepia objects, which is particularly useful for file system watchers and other tools that need to map file paths back to object instances.
Example
# Given a file path like "/data/MyDocument/uuid-123"
resolver = Sepia::PathResolver.new("/data")
info = resolver.resolve_path("/data/MyDocument/uuid-123")
info.class_name # => "MyDocument"
info.object_id # => "uuid-123"
info.full_path # => "/data/MyDocument/uuid-123"
Constructors
Instance methods
list_all_objects
List all Sepia objects in the storage directory
Returns an array of ObjectInfo for all found objects
resolver = PathResolver.new("/data")
objects = resolver.list_all_objects
objects.each do |info|
puts "#{info.class_name}: #{info.object_id}"
end
Resolve a path and load the actual Sepia object
This is a convenience method that combines resolve_path and object loading
obj = resolver.resolve_and_load("/data/MyDocument/uuid-123", TestDocument)
if obj
puts "Loaded: #{obj.class.name} (#{obj.sepia_id})"
end
Resolve a file system path to Sepia object information
info = resolver.resolve_path("/data/MyDocument/uuid-123")
info.class_name # => "MyDocument"
info.object_id # => "uuid-123"