Skip to content

Respect the visibility of new set before initialize is defined - #1891

Open
Asimmirzac wants to merge 1 commit into
ruby:masterfrom
Asimmirzac:private-new-before-initialize
Open

Asimmirzac wants to merge 1 commit into
ruby:masterfrom
Asimmirzac:private-new-before-initialize

Conversation

@Asimmirzac

Copy link
Copy Markdown

Fixes #1364.

private :new inside class << self and private_class_method :new only changed methods that were already registered. When they come before def initialize, as in the issue, ::new was documented as public. It only worked when they came after initialize.

The parser now remembers the last visibility given to new for each class and uses it when initialize is registered as ::new. A later public_class_method :new makes it public again, and private :new outside the singleton class has no effect.

The visibility is only remembered while parsing a file, so a class that makes new private in one file and defines initialize in a file parsed later is still documented as public.

`private :new` in `class << self` and `private_class_method :new` only
changed methods that were already documented, so they had no effect when
they came before `initialize`.

Fixes ruby#1364

This branch has not been deployed

No deployments
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.

rdoc 6.13.1 does not detect private :new

1 participant