Parent

Backports::StdLib::LoadedFeatures

Public Class Methods

mark_as_loaded(feature) click to toggle source
# File lib/backports/tools.rb, line 42
def self.mark_as_loaded(feature)
  # Nothing to do, the full path will be OK
end
new() click to toggle source

Full paths are recorded in $LOADED_FEATURES.

# File lib/backports/tools.rb, line 27
def initialize
  # Assume backported features are Ruby libraries (i.e. not C)
  @loaded = $LOADED_FEATURES.group_by{|p| File.basename(p, ".rb")}
end

Public Instance Methods

include?(feature) click to toggle source

Check loaded features for one that matches "#{any of the load path}/#{feature}"

# File lib/backports/tools.rb, line 33
def include?(feature)
  if fullpaths = @loaded[File.basename(feature, ".rb")]
    fullpaths.any?{|fullpath|
      base_dir, = fullpath.partition("/#{feature}")
      $LOAD_PATH.include?(base_dir)
    }
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.