Skip to content

Conversation

@midnight-wonderer
Copy link
Contributor

I wish there were these notes when I read the document.
The functionality is useful, especially for Digest and HMAC stuff.

I hope more people notice this somewhat hidden functionality.

@rhenium
Copy link
Member

rhenium commented Mar 10, 2025

Good catch! The empty docs are wrong, and this seems to be a side effect of commit 19cc58d.

However, initialize_copy shouldn't appear in the generated docs since it's a private method. It seems most of Ruby core methods use :nodoc: tag to hide it (for example, https://github.com/ruby/ruby/blob/97c133a8591495156f46b53c613abee8c7088a04/struct.c#L1120-L1136). Could you make it follow the convention?

I wish it were hidden by default in RDoc, though. A quick grep through RDoc's source shows no mention of the special method names like initialize_copy or respond_to_missing?, so it's probably mistakenly assuming the method to be public.

@midnight-wonderer
Copy link
Contributor Author

Main

Okay, the commit has been updated to follow the convention.

Fluff

It was a happy accident for me, though.
Without the unintended side effects, I would not know that HMAC is dup-safe.

I assumed dup wouldn't work, or at least not the way people intended since this is a native extension.
This opens the possibility of having pre-initialized HMAC without holding onto the raw secret key.

I wish I could add some notes on Digest and HMAC pages.
But maybe, in the future, people who care will be directed here by search engine algorithms already.

Copy link
Member

@rhenium rhenium left a comment

Choose a reason for hiding this comment

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

Thanks!

@rhenium rhenium merged commit b4877f8 into ruby:master Mar 12, 2025
54 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.

2 participants