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


=begin
@charliesome That doesn't quite fix the problem. 

  # foo/require_relative.rb
  alias_method :require_relative_without_callback, :require_relative

  def require_relative(feature)
    result  = require_relative_without_callback(feature)
    Kernel.loaded(feature) if result
    result
  end

  # bar/use_it.rb
  load 'foo/require_relative.rb'
  require_relative "anything"

Produces

  LoadError: cannot load such file -- foo/anything

But it should be (({bar/anything})).

Your suggestion would allow me to *re-implement* #relative_require. I know how to do that, I've done it before for Facets. But I've never felt it a very robust solution. 
=end

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

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/