Issue #7548 has been updated by trans (Thomas Sawyer).


=begin
Ran into a little snag with implementation of this as a simple Ruby library. It is not possible to override (({#require_relative})) to add the callback b/c it is lexically scoped (is that the right term for this?). In other words, (({#require_relative})) uses the (({__FILE__})) in which it is called. But any override ends up with the (({__FILE__})) in which the override is defined instead.

Is there a way around this? If not, then the only way to do this properly/completely is via core code. 
=end

----------------------------------------
Feature #7548: Load and Require Callbacks
https://bugs.ruby-lang.org/issues/7548#change-34819

Author: trans (Thomas Sawyer)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: next minor


=begin
Should #load and #require have callbacks? e.g.

  def required(path)
    ...
  end

  def loaded(path, wrap)
    ...
  end

On occasion I have wanted to do load monitoring to track down a bug. This would have made it easier.

Are there any other good use cases?
=end



-- 
http://bugs.ruby-lang.org/