Skip to content
CAI
Software that uses CAICheck a score

brainspec/enumerize

64.6

Adequate · 6 November 2026

1.2k

lines of production code

Ruby

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is the Enumerize gem, a Ruby library that provides enumerized attributes for models across ActiveRecord, ActiveModel, Sequel, and Mongoid. It enables developers to define typed, validated enum fields with support for multiple values, default handling, and query scopes. The library integrates with common form builders like SimpleForm and Formtastic, and includes dedicated RSpec matchers and RailsAdmin support for testing and administration.

How it got here

2012 — Enumerize 3.0.0 major release

7 changes.

This period focused on the major upgrade of the Enumerize gem to version 3.0.0, involving a complete rewrite of the core library to support modern Ruby and Rails versions. The work introduced scope support for ORM integrations, new integration hooks for form builders and validators, and a comprehensive test suite to ensure compatibility and correctness.

2013–2017 — ORM and testing integrations

6 changes.

This period focused on expanding the library's compatibility by adding native support for Sequel and Mongoid adapters, including query scope generation. It also introduced a comprehensive RSpec matcher for testing enumerized attributes and established a robust test configuration to support these new features.

Features

Add enumerize plugin to Sequel

A new enumerize plugin has been added to the Sequel library, located at lib/sequel/plugins/enumerize.rb. This plugin integrates the Enumerize gem with Sequel models by automatically loading the def\_dataset\_method plugin if it is not already present, and extending the model instance with Enumerize functionality.

lib/sequel · high confidence

Add scope generation support for Mongoid and Sequel adapters

Enumerize now supports generating query scopes for Mongoid and Sequel models in addition to the existing ActiveRecord support. Users can define scopes on enumerized attributes using the \:scope\ option, which generates methods like \with\\<attribute\>\ and \without\\<attribute\>\ to filter records by enumerized values. The implementation also supports \:shallow\ scopes, which create individual methods for each enum value (e.g., \status\_active\, \not\_status\_active\). This allows consistent scoping behavior across all three supported ORMs.

lib/enumerize/scope · high confidence

New RSpec matcher and RailsAdmin integration for enumerized attributes

Users can now use a dedicated RSpec matcher to test enumerized attributes, available by requiring 'enumerize/integrations/rspec'. Additionally, the library now includes a RailsAdmin integration that ensures the \_enum method correctly returns the attribute's options, improving compatibility with the RailsAdmin interface.

lib/enumerize/integrations · high confidence

New RSpec matcher for enumerized attributes

A new RSpec matcher is now available for testing enumerized attributes, allowing users to verify attribute definitions, expected values, default values, i18n scopes, predicates, multiple-value support, and scopes. The matcher supports chaining qualifiers like \in\, \with\_default\, \with\_i18n\_scope\, \with\_predicates\, \with\_multiple\, and \with\_scope\ to specify detailed expectations, and provides clear failure messages and descriptions for better debugging.

lib/enumerize/integrations/rspec · high confidence

New integration hooks for Formtastic, SimpleForm, Sequel, and Uniqueness validation

This change introduces four new integration modules in the \lib/enumerize/hooks\ directory. The \Formtastic\ and \SimpleForm\ hooks patch their respective form builders to automatically detect enumerized attributes and configure input options (such as setting collections and enabling multiple selection for multiple-value enums). The \Sequel\ hook ensures that \Enumerize::Value\ objects are correctly converted to their underlying values when appending to SQL literals. Additionally, the \Uniqueness\ validator hook extracts the actual value from enumerized attributes before performing uniqueness checks, ensuring validation works correctly with enumerized fields.

lib/enumerize/hooks · high confidence

Behavioural changes

Enumerize 3.0.0: Rails 8.1 compatibility and ActiveModel fixes

This release updates the gem to support Ruby 3.1+ and Rails 7.0+, with specific fixes for Rails 8.1 compatibility. It ensures that enumerized readers on plain \ActiveModel::Attributes\ objects return an \Enumerize::Value\ by wrapping values in \\#cast\, and fixes \Type\#deserialize\ to properly handle arrays for \multiple: true\ attributes. The release also allows objects to \becomes\ a non-Enumerize model and fixes \Type\#cast\ to support Rails 8.0 bulk operations.

(repo-wide) · high confidence

Enumerize library upgraded to version 3.0.0

The enumerize gem has been updated to version 3.0.0. This release includes a complete rewrite of the core library files (lib/enumerize/\*), introducing new modules for handling ActiveModel and ActiveRecord attributes, Mongoid, and Sequel integrations. Key behavioral changes include improved support for multiple attributes, better handling of default values via callbacks, and enhanced validation logic. The update also adds support for predicate methods and ensures compatibility with modern Rails versions by utilizing ActiveModel::Attributes and ActiveRecord::Type systems.

lib/enumerize · high confidence

Refactored core module structure and added scope support for ORM integrations

The library has been restructured to use \extend\ instead of \include\ for module inclusion, with a deprecation warning issued for the old \include Enumerize\ pattern. This change accompanies the introduction of scope support for ActiveRecord, Sequel, and Mongoid, allowing enumerized attributes to be used in query scopes. The core logic is now split into autoloaded sub-modules (Base, Attribute, Value, etc.), and integrations for SimpleForm, Formtastic, and RSpec are loaded conditionally to avoid hard dependencies.

lib · high confidence

Test coverage

Add RSpec test configuration and helper setup; Added test support infrastructure for view and enum testing; Added tests for the Enumerize RSpec matcher; Comprehensive test suite for enumerized attributes across frameworks.

Dependencies

Initial gem specification and dependency declaration for enumerize

The project now defines its package metadata and runtime requirements through enumerize.gemspec, replacing the previous Gemfile-based setup. This change specifies that the gem requires Ruby 3.2 or higher and declares a runtime dependency on activesupport version 3.2 or later, while also populating essential metadata such as the MIT license, author contact, and repository links.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 65 → 65 (-0.1)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 76 → 76 (+0.0)
  • Architecture 69 → 69 (+0.0)
  • Maturity 55 → 55 (+0.0)
  • Readiness 74 → 74 (+0.0)
  • Security 97 → 95 (-2.1)

Resolved (4)

  • Duplicate method signature write_attribute in different support modules. Both ActiveRecordSupport and ActiveModelAttributesSupport expose an instance method with the exact same signature. This suggests either redundant implementation or a lack of clear separation of concerns between ActiveModel and ActiveRecord support layers.
  • Inconsistent signature for reload. ActiveRecordSupport accepts an options argument, while MongoidSupport does not. This inconsistency forces consumers to handle different argument lists depending on the underlying ORM, violating the principle of least surprise.
  • Proliferation of 'enumerize' methods with identical signatures across many types. There are at least 11 different types exposing a method named enumerize (or similar) that takes (name, options) or (attr). This creates significant confusion about which method is the 'primary' API entry point and which are internal or integration-specific implementations. Enumerize.Base.ClassMethods.enumerize is likely the core, but it is not clearly distinguished from the support/integration layer methods.
  • Redundant and scattered 'included' hooks. The API exposes multiple distinct types/methods named 'included' across different namespaces (Enumerize, Base, Module, ModuleAttributes, Sequel.Plugins). It is unclear if these are separate extension points or if they represent a single conceptual hook that has been fragmented across the codebase. Specifically, Enumerize.included vs Enumerize.Base.included suggests a duplication of intent for module inclusion.

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

brainspec/enumerize was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 6 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 8688372f15af9b5c42921f7547eac3533a633499 — the exact code this score is about.
  • Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.