Module: Backports::StdLib
- Defined in:
- lib/backports/tools/std_lib.rb
Defined Under Namespace
Classes: LoadedFeatures
Class Attribute Summary collapse
-
.extended_lib ⇒ Object
Returns the value of attribute extended_lib.
Class Method Summary collapse
Class Attribute Details
.extended_lib ⇒ Object
Returns the value of attribute extended_lib.
39 40 41 |
# File 'lib/backports/tools/std_lib.rb', line 39 def extended_lib @extended_lib end |
Class Method Details
.extend_relative(relative_dir = "stdlib") ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/backports/tools/std_lib.rb', line 41 def extend_relative relative_dir="stdlib" loaded = Backports::StdLib::LoadedFeatures.new dir = File.(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.(f, dir) if loaded.include?(f) require path else @extended_lib[f] << path end end end |