lib/reconn/analyzer.rb
#Deletes dependencies which are not classes within analyzed project
Deletes dependencies which are not classes within analyzed project
Deletes dependencies which are not classes within analyzed project
def prune_dependencies
      class_names = @classes.map {|klass| klass.name}
      @classes.each do |klass|
        klass.dependencies =  klass.dependencies.map do |dep|
          dep_split = dep.split('::')
          if class_names.include?(dep)
            next dep
          end
          klass_split = klass.name.split('::')
          if klass_split.size != dep_split.size
            klass_split.pop(dep_split.size)
          else
            klass_split.pop(dep_split.size - 1)
          end
          (klass_split + dep_split).join('::')
        end
        klass.dependencies = klass.dependencies.uniq.keep_if {|dep| dep != klass.name && class_names.include?(dep)}
      end
    end
def prune_dependencies class_names = @classes . map { | klass | klass . name } @classes . each do | klass | klass . dependencies = klass . dependencies . map do | dep | dep_split = dep . split ( '::' ) if class_names . include? ( dep ) next dep end klass_split = klass . name . split ( '::' ) if klass_split . size != dep_split . size klass_split . pop ( dep_split . size ) else klass_split . pop ( dep_split . size - 1 ) end ( klass_split + dep_split ) . join ( '::' ) end klass . dependencies = klass . dependencies . uniq . keep_if { | dep | dep != klass . name && class_names . include? ( dep ) } end end
Deletes dependencies which are not classes within analyzed project
Deletes dependencies which are not classes within analyzed project