Skip to content

Instantly share code, notes, and snippets.

@alazycoder101
Created July 11, 2024 15:08
Show Gist options
  • Save alazycoder101/d2f73f371c911d2eb3e798db06f95836 to your computer and use it in GitHub Desktop.
Save alazycoder101/d2f73f371c911d2eb3e798db06f95836 to your computer and use it in GitHub Desktop.
require 'net/http'
module Net
class HTTP
def self.enable_debug!
class << self
alias_method :__new__, :new
def new(*args, &blk)
instance = __new__(*args, &blk)
instance.set_debug_output($stderr)
instance
end
end
end
def self.disable_debug!
class << self
alias_method :new, :__new__
remove_method :__new__
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment