Skip to content

Internalize routing scope flags behind Grape::Util::InheritableSetting accessors#2807

Open
ericproulx wants to merge 1 commit into
masterfrom
inheritable-setting-routing-flags
Open

Internalize routing scope flags behind Grape::Util::InheritableSetting accessors#2807
ericproulx wants to merge 1 commit into
masterfrom
inheritable-setting-routing-flags

Conversation

@ericproulx

Copy link
Copy Markdown
Contributor

Third batch of the namespace_inheritable cleanup (after #2805/#2806): the scope flags flipped by do_not_route_head!, do_not_route_options!, do_not_document! and lint! are now recorded and read through intention-revealing accessors on Grape::Util::InheritableSetting.

New accessors on InheritableSetting

Accessor Replaces
do_not_route_head! / do_not_route_head? namespace_inheritable[:do_not_route_head]
do_not_route_options! / do_not_route_options? namespace_inheritable[:do_not_route_options]
do_not_document! / do_not_document? namespace_inheritable[:do_not_document]
lint! / lint? namespace_inheritable[:lint]

Notes:

  • Naming: ! writers / ? readers mirror the DSL's own bang methods — completing the series' naming scheme (add_* = stacking, = = nearest-wins override, !/? = flag).
  • Converted call sites: DSL::Routing (the four bang methods), Endpoint (mount_in's HEAD-route check and lint?, which keeps its Grape.config.lint fallback), Validations::OneofCollector (do_not_document!) and Validations::ParamsDocumentation.
  • The flag reads in Grape::API::Instance#collect_route_config_per_pattern are deliberately untouched: they read from the plain Hash produced by the bulk namespace_inheritable.to_hash.except(...) — that consumer gets a dedicated accessor in the upcoming visibility-narrowing PR.
  • The ? readers return false rather than nil when never set; all consumers used boolean context only.
  • Storage under the raw keys is unchanged; they should now be considered internal. Specs assert through the accessors.

🤖 Generated with Claude Code

…g accessors

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Danger Report

No issues found.

View run

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.

1 participant