Skip to content

Add {Method,UnboundMethod}#{public?,private?,protected?} - #5040

Merged
jeremyevans merged 1 commit into
ruby:masterfrom
jeremyevans:method-visibility-predicates-11689
Dec 9, 2021
Merged

Add {Method,UnboundMethod}#{public?,private?,protected?}#5040
jeremyevans merged 1 commit into
ruby:masterfrom
jeremyevans:method-visibility-predicates-11689

Conversation

@jeremyevans

Copy link
Copy Markdown
Contributor

These methods allow for checking whether the method has that
visibility.

Implements [Feature #11689]

@ioquatix

Copy link
Copy Markdown
Member

These are great predicates. Would it also make sense to introduce a single method like visibility => :public|:protected|:private?

@jeremyevans

Copy link
Copy Markdown
Contributor Author

These are great predicates. Would it also make sense to introduce a single method like visibility => :public|:protected|:private?

That's actually what the requester of the related feature asked for. Matz requested public?/protected?/private? instead.

@ioquatix

ioquatix commented Oct 28, 2021

Copy link
Copy Markdown
Member

For typical use case, I imagine it's cumbersome to check 3 different predicates to determine visibility, e.g. for debugging and/or logging.

These methods allow for checking whether the method has that
visibility.

Implements [Feature ruby#11689]
@jeremyevans
jeremyevans force-pushed the method-visibility-predicates-11689 branch from 344daf4 to 020d77f Compare December 9, 2021 15:38
@jeremyevans
jeremyevans merged commit 2727815 into ruby:master Dec 9, 2021
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