Crtemp
Inherits Dir < Iterable < Enumerable < Reference < Object
Constants
Constructors
Creates a new temporary directory.
Arguments are passed directly to File.tempname to generate the directory name.
The directory is created with secure permissions (0o700) and is automatically
cleaned up when the Crtemp instance is closed or finalized.
Raises:
CreationErrorif the directory cannot be createdPermissionErrorif the parent directory has insecure permissions
Class methods
Creates a new temporary directory with Result-based error handling.
Arguments are passed directly to File.tempname to generate the directory name.
The directory is created with secure permissions (0o700) and cleanup must be
handled manually by calling #close.
Returns:
- Success with Crtemp instance on successful creation
- Failure with CreationError or PermissionError on failure
Instance methods
Closes and removes the temporary directory and all its contents.
This method is idempotent - calling it multiple times has no effect after the first call.
Result-returning variant of create_tempfile