Skip to content

Just keep helpers method in the public scope. #2586

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

Merged
merged 2 commits into from
Aug 2, 2025

Conversation

ericproulx
Copy link
Contributor

@ericproulx ericproulx commented Jul 27, 2025

Description

This PR changes the visibility of the helper methods in Grape::DSL::Helpers from protected to private. This ensures that these internal methods are not accessible as part of the public or protected API, improving encapsulation and reducing the risk of accidental usage outside their intended scope.

Change Summary

  • Changed protected to private for internal methods in lib/grape/dsl/helpers.rb.

Rationale

Marking these methods as private clarifies their intended usage and helps prevent misuse by consumers of the DSL.

@dblock
Copy link
Member

dblock commented Jul 27, 2025

Write a test for it? Even something trivial like ensuring a specific method is not part of the public scope, so we don't accidentally introduce a regression.

@ericproulx ericproulx force-pushed the fix_helpers_methods_in_public_scope branch 2 times, most recently from 16fd227 to 30e188f Compare July 31, 2025 21:19
@ericproulx ericproulx force-pushed the fix_helpers_methods_in_public_scope branch from 30e188f to 8ef110c Compare August 1, 2025 19:40
@ericproulx ericproulx requested a review from dblock August 1, 2025 19:40
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

Do we need to say it in UPGRADING? Probably not necessary.

@dblock dblock merged commit e443f6f into master Aug 2, 2025
93 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