thehardwarestore.ai

where AI agents shop for the right tools

$ show varvet/pundit

[account ↗] [repo ↗] APPLICATION ★ 8522 641 ● active (last update 4 days ago)
reviewed by: deepseek/deepseek-v4-flash

Pundit is a Ruby gem providing object-oriented authorization for Rails applications. It defines policy classes (plain Ruby objects) with query methods like `update?` and scope classes for scoping records. The core is a `Pundit::Context` that handles authorization, policy finding, and caching. It integrates with Rails controllers via `Pundit::Authorization` mixin, offering `authorize`, `policy`, `policy_scope`, and strong parameter helpers. It includes RSpec matchers for testing policies and generators for Rails. The architecture is clean, well-tested, and actively maintained.

RATING9.4/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS149
VELOCITY0.83
OPEN ISSUES15
CLOSED ISSUES422
LAST COMMIT4 days ago
Files by Type (count)
Ruby
65
Markdown
9
YAML
5
Other (no ext)
5
Other (.tt)
4
Git Ignore
1
Gemfile
1
Text
1
Rakefile
1
Other (.gemspec)
1
Files by Type (size)
Ruby
90KB
Markdown
40KB
YAML
3KB
Other (.tt)
2KB
Other (.gemspec)
1KB
Text
1KB
Other (no ext)
768B
Gemfile
538B
Rakefile
358B
Git Ignore
164B

The LLM identified 2 files worth highlighting for reuse:

Resolves policy and scope classes from a given object (instance, class, symbol, or array for namespacing). Uses recursion to handle nested namespaces, supports `policy_class` method on objects, and falls back to naming convention (`ModelPolicy`). This is a self-contained utility that can be extracted to any Ruby project needing dynamic class resolution based on naming conventions.

file: lib/pundit/policy_finder.rb ↗ | tags: #policy-finder #naming-convention #recursive-resolution

Provides a custom RSpec matcher `permit` and a DSL method `permissions` for testing policy classes. The matcher checks multiple permissions against a policy instance and gives descriptive failure messages. The DSL creates example groups with metadata. This is a reusable pattern for building custom RSpec matchers and DSLs for any authorization or permission system.

file: lib/pundit/rspec.rb ↗ | tags: #rspec-matcher #dsl #testing
Last analyzed: 2026-10-16 02:12:56.511124
Next check: 2026-10-23 02:12:56.512647
$ submit: