Skip to content

Instantly share code, notes, and snippets.

@fxn
Created July 30, 2023 11:07
Show Gist options
  • Save fxn/2054032ff038b2bbe1f30aa6d06f0242 to your computer and use it in GitHub Desktop.
Save fxn/2054032ff038b2bbe1f30aa6d06f0242 to your computer and use it in GitHub Desktop.
autoload :Date, 'date'
module Kernel
alias_method :original_require, :require
def require(path)
puts "Require invoked for #{path}"
original_require(path).tap do |loaded|
if loaded
sleep 1
puts "Loaded #{path}"
end
end
end
end
threads = Array.new(10) do
Thread.new { Date }
end
threads.each(&:join)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment