• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ruby-grape / grape / 25959131120

16 May 2026 10:02AM UTC coverage: 97.035%. First build
25959131120

Pull #2725

github

ericproulx
Encapsulate Grape::Validations::Validators::Base state behind readers

Route all internal reads of the Base validator's instance variables
through accessor methods instead of touching @ivars directly, in Base
and every subclass.

- Add private `attr_reader :options, :scope, :required, :allow_blank,
  :exception_message`; `:attrs` stays a public reader (unchanged
  external behavior).
- Booleans get `?` aliases consistent with `fail_fast?`:
  `required?`, `allow_blank?`, `fail_fast?` (now `attr_reader` + alias).
- Only `attrs`/`fail_fast?` remain public — the readers actually
  crossing the validator boundary (Grape::Endpoint#run_validators).
- Rename locals that shadowed the new readers (`attrs`/`scope`).

Pure internal refactor: no behavior change, full validation and
endpoint suites green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request #2725: Encapsulate Grape::Validations::Validators::Base state behind readers

1084 of 1167 branches covered (92.89%)

Branch coverage included in aggregate %.

38 of 39 new or added lines in 9 files covered. (97.44%)

3498 of 3555 relevant lines covered (98.4%)

32113.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
/lib/grape/validations/validators/default_validator.rb


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc