module ProcessExecuter::Destinations
def self.compatible_with_monitored_pipe?(destination)
- Api: - public
Raises:
-
(ArgumentError)- if no matching destination class is found
Returns:
-
(Boolean, nil)- true if the destination is compatible with a monitored pipe
Parameters:
-
destination(Object) -- the destination to check
def self.compatible_with_monitored_pipe?(destination) matching_class = matching_destination_class(destination) matching_class&.compatible_with_monitored_pipe? end
def self.factory(destination)
-
(ArgumentError)- if no matching destination class is found
Returns:
-
(DestinationBase)- an instance of the appropriate destination handler
Parameters:
-
destination(Object) -- the destination to create a handler for
def self.factory(destination) matching_class = matching_destination_class(destination) return matching_class.new(destination) if matching_class raise ArgumentError, 'wrong exec redirect action' end
def self.matching_destination_class(destination)
- Api: - private
Returns:
-
(Class)- the destination class that can handle the given destination
Parameters:
-
destination(Object) -- the destination to check
def self.matching_destination_class(destination) destination_classes = ProcessExecuter::Destinations.constants .map { |const| ProcessExecuter::Destinations.const_get(const) } .select { |const| const.is_a?(Class) } destination_classes.find { |klass| klass.handles?(destination) } end