Created
November 2, 2013 21:06
-
-
Save wuputah/7283522 to your computer and use it in GitHub Desktop.
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
if Rails.env.development? | |
lambda do | |
forbidden_files = ['active_support/core_ext/object/to_json'] | |
module Kernel | |
def require_with_dont_load_forbidden_files(name) | |
if forbidden_files.include?(name) | |
raise LoadError, "#{name} is forbidden" | |
end | |
require_without_dont_load_forbidden_files(name) | |
end | |
alias_method_chain :require, :dont_load_forbidden_files | |
end | |
forbidden_files.each do |f| | |
raise LoadError, "someone loaded a forbidden file: #{f}" if $".include?(f) | |
end | |
end.call | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment