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

Convert View generator to use RubyClassFile #284

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

cllns
Copy link
Member

@cllns cllns commented Jan 4, 2025

In the course of this, I realized the RubyFileWriter (with #call) is the wrong abstraction. It would create the file, but we couldn't find out any info about that class. In the case of view generation, the template shows the name of the view class, so it needs to be able to see that. In general, being able to get info from a newly generated class file seems useful in other contexts as well (imagine creating an action + operation, the action needs to know what the operation is called).

We already had an internal ClassFile helper inside RubyFileWriter, so I extracted that to its own RubyClassFile class, which we use in this PR. I added a #fully_qualified_name method too.

If we're happy with this change to the abstraction (RubyFileWriter -> RubyClassFile), I can backport the change to the other ones we've already switched. It's just a minor change and I think it's a better API (to call #create instead of #call). Since this class has always been private API (and it's an implementation detail for us, not a part of the core framework), I think it's fine to remove it during a patch release, but I'm also fine leaving it around if we're worried about backwards compatibility

@cllns cllns requested a review from timriley January 4, 2025 01:14
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