Skip to content

Commit

Permalink
add #to_str to URI::Generic
Browse files Browse the repository at this point in the history
  • Loading branch information
saraid authored and hsbt committed Oct 26, 2023
1 parent f4999b6 commit 5c17cd2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/uri/generic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,7 @@ def to_s
end
str
end
alias to_str to_s

#
# Compares two URIs.
Expand Down

2 comments on commit 5c17cd2

@sferik
Copy link

@sferik sferik commented on 5c17cd2 Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to also add this method to the RBS type signature? When I try type checking my file, I get the following error:

lib/x/oauth_authenticator.rb:42:10: [error] Type `::URI::Generic` does not have method `to_str`
│ Diagnostic ID: Ruby::NoMethod
│
└       uri.to_str.chomp("?#{uri.query}")

I would add this myself, but I can't find the RBS signature definition file in this repository.

@hsbt
Copy link
Member

@hsbt hsbt commented on 5c17cd2 Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. We are starting to add sig to each library in recently.

ruby/prime#24

Please sign in to comment.