Class: ProcessExecuter::Destinations::DestinationBase Private

Inherits:
Object
  • Object
show all
Defined in:
lib/process_executer/destinations/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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#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

Parameters:

  • destination (Object)

    the destination to write to



16
17
18
# File 'lib/process_executer/destinations/destination_base.rb', line 16

def initialize(destination)
  @destination = destination
end

Instance Attribute Details

#destinationObject (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

Returns:

  • (Object)

    the destination object



23
24
25
# File 'lib/process_executer/destinations/destination_base.rb', line 23

def destination
  @destination
end

Class Method Details

.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.

Returns:

  • (Boolean)


63
# File 'lib/process_executer/destinations/destination_base.rb', line 63

def self.compatible_with_monitored_pipe? = true

.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.

Parameters:

  • destination (Object)

    the destination to check

Returns:

  • (Boolean)

    true if this class can handle the destination

Raises:

  • (NotImplementedError)

    if the subclass doesn't implement this method



53
54
55
# File 'lib/process_executer/destinations/destination_base.rb', line 53

def self.handles?(destination)
  raise NotImplementedError
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 destination if necessary

By default, this method does nothing. Subclasses should override this method if they need to perform cleanup.



44
# File 'lib/process_executer/destinations/destination_base.rb', line 44

def close; end

#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

Returns:

  • (Boolean)


68
69
70
# File 'lib/process_executer/destinations/destination_base.rb', line 68

def compatible_with_monitored_pipe?
  self.class.compatible_with_monitored_pipe?
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 destination

Subclasses should override this method to provide specific write behavior. The base implementation is a no-op.

Parameters:

  • _data (String)

    the data to write

Returns:

  • (Integer)

    the number of bytes written



34
35
36
# File 'lib/process_executer/destinations/destination_base.rb', line 34

def write(_data)
  0
end