Module: WashoutBuilder::Document::SharedComplexType

Included in:
ComplexType, ExceptionModel
Defined in:
lib/washout_builder/document/shared_complex_type.rb

Overview

module that is used for both complex types and exception class to find their ancestors and filter out some of the ancestors

Instance Method Summary collapse

Instance Method Details

#get_complex_type_ancestors(class_name, array) ⇒ Array<Class>

Method that is used to fetch the ancestors of a class and fiter the ancestors that are present in the second argument

Parameters:

  • class_name (Class)

    The class that is used to fetch the ancestors for

  • array (Array<Class>)

    The array of classes that should be fitered from the ancestors if they are present

Returns:

  • (Array<Class>)

    The classes from which the class given as first argument inherits from but filtering the classes passed as second argument



10
11
12
13
14
15
16
# File 'lib/washout_builder/document/shared_complex_type.rb', line 10

def get_complex_type_ancestors(class_name, array)
  (class_name.ancestors - class_name.included_modules).delete_if do |x|
    x.to_s.downcase == class_name.to_s.downcase ||
      array.include?(x.to_s) ||
      (x.respond_to?(:abstract_class) && x.abstract_class)
  end
end