Sha256: f97dab86209412ce7cfa7c78a01f8e68ecd9292962104f99b709f3c8d869615f
Contents?: true
Size: 1.77 KB
Versions: 4
Compression:
Stored size: 1.77 KB
Contents
module WashoutBuilder # class that is used to define the basic types and the basic exception classes that should be considered class Type # the basic types that are considered when checking an object type BASIC_TYPES = %w(string integer double boolean date datetime float time int) # returns all the exception classes that should be considered to be detected # # @return [Array<Class>] returns all the exception classes that should be considered to be detected # @api public def self.all_fault_classes faults = [] faults << WashOut::SOAPError if defined?(WashOut::SOAPError) faults << WashOut::Dispatcher::SOAPError if defined?(WashOut::Dispatcher::SOAPError) faults << SOAPError if defined?(SOAPError) faults end # Checks if a exception class inherits from the basic ones # @see #all_fault_classes # # @param [Class] fault_class the exception class that needs to be checks if has as ancestor one of the base classes # @return [Boolean] Returns true if the class inherits from the basic classes or false otherwise # @api public def self.ancestor_fault?(fault_class) fault_class.ancestors.find { |fault| all_fault_classes.include?(fault) }.present? end # Checks if a exception class is valid, by checking if either is a basic exception class or has as ancerstor one ot the base classes # # @param [Class] fault The exception class that needs to be checks if has as ancestor one of the base classes or is one of them # @return [Boolean] Returns true if the class inherits from the basic classes or is one of them, otherwise false # @api public def self.valid_fault_class?(fault) fault.is_a?(Class) && (ancestor_fault?(fault) || all_fault_classes.include?(fault)) end end end
Version data entries
4 entries across 4 versions & 1 rubygems