Class: ProcessExecuter::DestinationBase Private
- Inherits:
-
Object
- Object
- ProcessExecuter::DestinationBase
- Defined in:
- lib/process_executer/destination_base.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.
Base class for all destination handlers
Provides the common interface and functionality for all destination classes that handle different types of output redirection.
Direct Known Subclasses
ProcessExecuter::Destinations::ChildRedirection, ProcessExecuter::Destinations::Close, ProcessExecuter::Destinations::FileDescriptor, ProcessExecuter::Destinations::FilePath, ProcessExecuter::Destinations::FilePathMode, ProcessExecuter::Destinations::FilePathModePerms, ProcessExecuter::Destinations::IO, ProcessExecuter::Destinations::MonitoredPipe, ProcessExecuter::Destinations::Stderr, ProcessExecuter::Destinations::Stdout, ProcessExecuter::Destinations::Tee, ProcessExecuter::Destinations::Writer
Instance Attribute Summary collapse
-
#data_written ⇒ Array<String>
readonly
private
The data written to the destination.
-
#destination ⇒ Object
readonly
private
The destination object this handler manages.
Class Method Summary collapse
-
.compatible_with_monitored_pipe? ⇒ Boolean
private
Determines if this destination class can be wrapped by MonitoredPipe.
-
.handles?(destination) ⇒ Boolean
private
Determines if this class can handle the given destination.
Instance Method Summary collapse
-
#close
private
Closes the destination if necessary.
-
#compatible_with_monitored_pipe? ⇒ Boolean
private
Determines if this destination instance can be wrapped by MonitoredPipe.
-
#initialize(destination) ⇒ DestinationBase
constructor
private
Initializes a new destination handler.
-
#string ⇒ String
private
The data written to the destination as a single string.
-
#write(data)
private
Writes data to the destination.
Constructor Details
permalink #initialize(destination) ⇒ DestinationBase
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 destination handler
15 16 17 18 |
# File 'lib/process_executer/destination_base.rb', line 15 def initialize(destination) @destination = destination @data_written = [] end |
Instance Attribute Details
permalink #data_written ⇒ Array<String> (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 data written to the destination
28 29 30 |
# File 'lib/process_executer/destination_base.rb', line 28 def data_written @data_written end |
permalink #destination ⇒ Object (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 destination object this handler manages
23 24 25 |
# File 'lib/process_executer/destination_base.rb', line 23 def destination @destination end |
Class Method Details
permalink .compatible_with_monitored_pipe? ⇒ 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 destination class can be wrapped by MonitoredPipe
All destination types can be wrapped by MonitoredPipe unless they explicitly opt out.
73 |
# File 'lib/process_executer/destination_base.rb', line 73 def self.compatible_with_monitored_pipe? = true |
permalink .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
This is an abstract class method that must be implemented by subclasses.
62 63 64 |
# File 'lib/process_executer/destination_base.rb', line 62 def self.handles?(destination) raise NotImplementedError end |
Instance Method Details
permalink #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 destination if necessary
By default, this method does nothing. Subclasses should override this method if they need to perform cleanup.
53 |
# File 'lib/process_executer/destination_base.rb', line 53 def close; end |
permalink #compatible_with_monitored_pipe? ⇒ 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 destination instance can be wrapped by MonitoredPipe
79 80 81 |
# File 'lib/process_executer/destination_base.rb', line 79 def compatible_with_monitored_pipe? self.class.compatible_with_monitored_pipe? end |
permalink #string ⇒ String
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 data written to the destination as a single string
32 33 34 |
# File 'lib/process_executer/destination_base.rb', line 32 def string data_written.join end |
permalink #write(data)
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.
Writes data to the destination
This is an abstract method that must be implemented by subclasses.
43 44 45 |
# File 'lib/process_executer/destination_base.rb', line 43 def write(data) @data_written << data end |