Class: ProcessExecuter::Destinations::FilePathModePerms Private
- Inherits:
-
ProcessExecuter::DestinationBase
- Object
- ProcessExecuter::DestinationBase
- ProcessExecuter::Destinations::FilePathModePerms
- Defined in:
- lib/process_executer/destinations/file_path_mode_perms.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Handles file paths with specific open modes and permissions
Instance Attribute Summary collapse
-
#file ⇒ File
readonly
private
The opened file object.
Attributes inherited from ProcessExecuter::DestinationBase
Class Method Summary collapse
-
.handles?(destination) ⇒ Boolean
private
Determines if this class can handle the given destination.
Instance Method Summary collapse
-
#close
private
Closes the file if it's open.
-
#initialize(destination) ⇒ FilePathModePerms
constructor
private
Initializes a new file path with mode and permissions destination handler.
-
#write(data) ⇒ Integer
private
Writes data to the file.
Methods inherited from ProcessExecuter::DestinationBase
#compatible_with_monitored_pipe?, compatible_with_monitored_pipe?, #string
Constructor Details
#initialize(destination) ⇒ FilePathModePerms
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes a new file path with mode and permissions destination handler
Opens the file at the given path with the specified mode and permissions.
17 18 19 20 |
# File 'lib/process_executer/destinations/file_path_mode_perms.rb', line 17 def initialize(destination) super @file = File.open(destination[0], destination[1], destination[2]) end |
Instance Attribute Details
#file ⇒ File (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The opened file object
25 26 27 |
# File 'lib/process_executer/destinations/file_path_mode_perms.rb', line 25 def file @file end |
Class Method Details
.handles?(destination) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Determines if this class can handle the given destination
52 53 54 55 56 57 58 |
# File 'lib/process_executer/destinations/file_path_mode_perms.rb', line 52 def self.handles?(destination) destination.is_a?(Array) && destination.size == 3 && destination[0].is_a?(String) && destination[1].is_a?(String) && destination[2].is_a?(Integer) end |
Instance Method Details
#close
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Closes the file if it's open
44 45 46 |
# File 'lib/process_executer/destinations/file_path_mode_perms.rb', line 44 def close file.close unless file.closed? end |
#write(data) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Writes data to the file
36 37 38 39 |
# File 'lib/process_executer/destinations/file_path_mode_perms.rb', line 36 def write(data) super file.write data end |