Remove Settings Unset Functions #2598
Merged
+24
−52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Remove Settings Unset Functions
Summary
This PR removes several internal "unset" functions from the Grape DSL settings module that were not part of the public API and simplifies the codebase by consolidating functionality and improving maintainability.
Changes Made
Removed Functions from
Grape::DSL::Settings
unset(type, key)
- Generic unset method for deleting keys from settingsunset_namespace_stackable(*keys)
- Convenience method for unsetting multiple namespace stackable keysnamespace_inheritable_to_nil(key)
- Method for setting namespace inheritable values to nilnamespace_reverse_stackable_with_hash(key)
- Method for getting namespace reverse stackable values as a hashCode Consolidation
1. Simplified
reset_validations!
methodunset_namespace_stackable(:declared_params, :params, :validations)
inheritable_setting.namespace_stackable.delete(:declared_params, :params, :validations)
2. Enhanced
BaseInheritable#delete
methoddelete(key)
- only accepted single keydelete(*keys)
- accepts multiple keys and returns array of deleted values3. Refactored
without_root_prefix_and_versioning
methodnamespace_inheritable_to_nil
calls and manual restorationensure
block4. Moved
namespace_reverse_stackable_with_hash
logicGrape::DSL::Settings
rescue_handlers
inGrape::Endpoint
(only place it was used)Test Updates
unset
andunset_namespace_stackable
methodsreset_validations!
test to verify actual behavior instead of method callsBenefits
without_root_prefix_and_versioning
method now usesensure
blocks for proper cleanupdelete
method now supports multiple keysBreaking Changes
None - All removed methods were internal and not part of the public API.
Testing
reset_validations!
instead of just method callsRelated Issues
This cleanup is part of ongoing efforts to simplify the Grape codebase and remove unnecessary internal APIs that were not intended for public use.