-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
187 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'backload/load' | ||
require 'backload/require' | ||
#require 'backload/require_relative' | ||
|
||
module Kernel | ||
|
||
# Common callback for all loading methods: #load, #require | ||
# and #require_relative. | ||
# | ||
# @param [Hash] options | ||
# The load callback options. | ||
# | ||
# @option options [Boolean] :load | ||
# True if #load was used. | ||
# | ||
# @option options [Boolean] :require | ||
# True is #require or #require_relative was used. | ||
# | ||
# @option options [Boolean] :relative | ||
# True is #require_relative was used. | ||
# | ||
# @option options [Boolean] :wrap | ||
# The wrap argument passed to #load. | ||
# | ||
def self.backloaded(path, options={}) | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This does not look doable in pure Ruby. | ||
|
||
#module Kernel | ||
# | ||
# # | ||
# # We create a noop method b/c it simplifes implementation. | ||
# # Just override this method to use. | ||
# # | ||
# def self.autoloaded(path, options={}) | ||
# end | ||
# | ||
#end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
module Kernel | ||
|
||
# | ||
# We create a noop method b/c it simplifes implementation. | ||
# Just override this method to use. | ||
# | ||
def self.loaded(path, wrap=nil) | ||
end | ||
|
||
private | ||
|
||
# | ||
# Alias original Kernel#load method. | ||
# | ||
alias_method :load_without_callback, :load | ||
|
||
# | ||
# Redefine Kernel#load with callback. | ||
# | ||
def load(path, wrap=nil) | ||
result = load_without_callback(feature, options[:wrap]) | ||
|
||
if result | ||
Kernel.loaded(path, wrap) | ||
Kernel.backloaded(path, :load=>true, :require=>false, :wrap=>wrap) | ||
end | ||
|
||
result | ||
end | ||
|
||
class << self | ||
# | ||
# Alias original Kernel.load method. | ||
# | ||
alias_method :load_without_callback, :load | ||
|
||
# | ||
# Redefine Kernel.load with callback. | ||
# | ||
def load(path, wrap=nil) | ||
result = load_without_callback(path, wrap) | ||
|
||
if result | ||
Kernel.loaded(path, wrap) | ||
Kernel.backloaded(path, :load=>true, :require=>false, :wrap=>wrap) | ||
end | ||
|
||
result | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.