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

allow uris to merge with anythig coercing to string #746

Merged
merged 1 commit into from
Aug 18, 2021

Conversation

HoneyryderChuck
Copy link
Contributor

a = URI("http://google.com")
a.merge("/path")
=> #<URI::HTTP http://google.com/path>
irb(main):004:0> a.merge(URI("/path"))
=> #<URI::HTTP http://google.com/path>
irb(main):005:0> a.merge(URI("http://cdn.com/path"))
=> #<URI::HTTP http://cdn.com/path>
irb(main):006:-> a.merge(:"http://cdn.com/path"))
class A
  def to_str
    "/path"
  end
end
a.merge(A.new)
=> #<URI::HTTP http://google.com/path>

```ruby
a = URI("http://google.com")
a.merge("/path")
=> #<URI::HTTP http://google.com/path>
irb(main):004:0> a.merge(URI("/path"))
=> #<URI::HTTP http://google.com/path>
irb(main):005:0> a.merge(URI("http://cdn.com/path"))
=> #<URI::HTTP http://cdn.com/path>
irb(main):006:-> a.merge(:"http://cdn.com/path"))
class A
  def to_str
    "/path"
  end
end
a.merge(A.new)
=> #<URI::HTTP http://google.com/path>
```
@soutaro soutaro merged commit 2511d1f into ruby:master Aug 18, 2021
@HoneyryderChuck HoneyryderChuck deleted the fix-uri-sigs branch August 18, 2021 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants