module Backports::StdLib

Attributes

extended_lib[RW]

Public Class Methods

extend_relative(relative_dir="stdlib") click to toggle source
# File lib/backports/tools/std_lib.rb, line 41
def extend_relative relative_dir="stdlib"
  loaded = Backports::StdLib::LoadedFeatures.new
  dir = File.expand_path(relative_dir, File.dirname(caller.first.split(/:\d/,2).first))
  Dir.entries(dir).
    map{|f| Regexp.last_match(1) if /^(.*)\.rb$/ =~ f}.
    compact.
    each do |f|
      path = File.expand_path(f, dir)
      if loaded.include?(f)
        require path
      else
        @extended_lib[f] << path
      end
    end
end