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

Fixed Addressable::URI#inspect to use self.class. #544

Merged
merged 2 commits into from
Aug 22, 2024

Conversation

postmodern
Copy link
Contributor

This will allow sub-classing Addressable::URI and have the sub-classes name show up in the inspect output.

class CustomURL < Addressable::URI

  def custom_method
     ...
  end

end

uri = CustomURL.parse("https://example.com")
# => #<CustomURL:0x1824 URI:https://example.com>

* This will allow sub-classing `Addressable::URI` and have the
  sub-classes name show up in the `inspect` output.

      class CustomURL < Addressable::URI

        def custom_method
	  ...
	end

      end

      uri = CustomURL.parse("https://example.com")
      # => #<CustomURL:0x1824 URI:https://example.com>
Copy link
Collaborator

@dentarg dentarg left a comment

Choose a reason for hiding this comment

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

LGTM

# main
$ ruby -raddressable/uri -e 'class CustomURIClass < Addressable::URI;end; p CustomURIClass.new.inspect'
"#<Addressable::URI:0x3c URI:>"

# this PR
$ ruby -Ilib -raddressable/uri -e 'class CustomURIClass < Addressable::URI;end; p CustomURIClass.new.inspect'
"#<CustomURIClass:0x3c URI:>"

@dentarg
Copy link
Collaborator

dentarg commented Aug 13, 2024

Unfortunately merging is blocked by #543 – I can not resolve this myself

@postmodern
Copy link
Contributor Author

Hmm, GitHub Actions suddenly sprung to life and ran on my work of addressable-uri. Only one job failed (macOS tests) with no output.
https://github.com/postmodern/addressable/actions/runs/10360606576/job/28679370905

@sporkmonger
Copy link
Owner

Should be unblocked now! Sorry I didn't see the problem earlier!

@dentarg dentarg merged commit 4229164 into sporkmonger:main Aug 22, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants