Module: Exerb::Utility2

Defined in:
lib/exerb/utility2.rb

Overview

#

Class Method Summary collapse

Class Method Details

.loaded_features(reject_list = []) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/exerb/utility2.rb', line 13

def self.loaded_features(reject_list = [])
  reject_list << File.expand_path(__FILE__)

  return $".collect { |filename|
    case filename.downcase
    when /\.rb$/o  then type = "script"
    when /\.so$/o  then type = "extension-library"
    when /\.dll$/o then type = "extension-library"
    end
    [type, filename]
  }.collect { |type, filename|
    if File.exist?(filename)
      [type, filename, filename]
    else
      $LOAD_PATH.collect { |dirpath|
        [type, filename, File.join(dirpath, filename)]
      }.find { |type, filename, filepath|
        File.exist?(filepath)
      }
    end
  }.compact.reject { |type, filename, filepath|
    type.nil?
  }.reject { |type, filename, filepath|
    reject_list.index(File.expand_path(filepath))
  }
end