Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refining classes in net/http #183

Open
forthrin opened this issue Aug 29, 2024 · 1 comment
Open

Refining classes in net/http #183

forthrin opened this issue Aug 29, 2024 · 1 comment

Comments

@forthrin
Copy link

What is the proper way to refine the initializer of this class? The below does not seem work.

require 'net/http'

module Foo
  refine Gem::Net::HTTPGenericRequest.singleton_class do
    def new(*)
      obj = super
      puts 'IT WORKS!
      obj
    end
  end
end

using Foo

http = Net::HTTP.new('localhost', '8080')
http.send_request('GET', '/')
@forthrin
Copy link
Author

@HoneyryderChuck: Do you have a solution here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant