Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement enum inspector via spy #296

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tk0miya
Copy link
Collaborator

@tk0miya tk0miya commented Feb 2, 2025

So far, enum inspector has been implemented by static code analysis.
But it is a bit fragile and difficult to maintain.

This reimplements the inspector by spy technique. The new inspector
collects the enums definitions on loading ActiveRecord models.

Note: The new enum inspector must be installed before ActiveRecord
models loading.

Note: This includes #294 and #295

Since ruby-3.5, the benchmark gem has been moved to the bundled gem
from default gems. Therefore it should be loaded explicitly in Gemfile.

https://bugs.ruby-lang.org/issues/20309
The signatures of Rake::TaskLib has been registered to
gem_rbs_collection.  Thefore custom types are no longer needed.

ref: https://github.com/ruby/gem_rbs_collection/blob/main/gems/rake/13.0/rake.rbs
So far, enum inspector has been implemented by static code analysis.
But it is a bit fragile and difficult to maintain.

This reimplements the inspector by spy technique.  The new inspector
collects the enums definitions on loading ActiveRecord models.

Note: The new enum inspector must be installed before ActiveRecord
models loading.
@tk0miya
Copy link
Collaborator Author

tk0miya commented Feb 2, 2025

@pocke Could you review this, please? I implemented this relying on my memory because I lost the URL of your design doc. I hope this is matched to what you expected.

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