$LOADED FEATURES

From WhyNotWiki

Jump to: navigation, search
irb -> $LOAD_PATH.find {|d| Dir.entries(d).include?('erb.rb') }
    => "/usr/lib/ruby/1.8"

irb -> require 'erb'
    => true

irb -> $LOAD_FEATURES
    => nil

irb -> $LOADED_FEATURES.grep(/erb/)
    => ["erb.rb"]        # Not 'erb' like how I required it.
                         # Also not "/usr/lib/ruby/1.8/erb.rb" (the full path)

Aside:


irb -> load 'erb.rb'
    => true

irb -> $LOADED_FEATURES.grep(/erb/)
    => []     # Not there? Why not?
 

I wish it added the full path of each loaded file/feature to $LOADED_FEATURES!

It would also fix the double-require bug!!

Personal tools