-
Notifications
You must be signed in to change notification settings - Fork 134
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
Parameterized blueprints #45
Comments
Hmmm, not sure. It'd be a mess to implement on top of the current named blueprints and caching mechanism. I'd rather find some way to pass stuff like this in as extra arguments, but I'm not sure how to fit that in with the existing arguments to make. |
Are you thinking something like:
That syntax for making the objects feels less clear to me. Keeping pecs/tests as clear and concise as possible is paramount for me. However, having this functionality is more important than the syntax. If you have a strong preference i am open to implementing that. I haven't looked at the internals of the caching mechanism yet. I'll take a look soon an see if i can see an approach to caching the results of parameterized blueprints. |
the randexp gem would work great for this, check it out |
The caching mechanism is now gone, but this still all feels a bit too magic to me. I'd just make some nice helper methods that wrap calls to Machinist if I was doing the same thing. That said, feel free to fork and give it a go. You may come up with something that surprises me, and even if you don't, there's no harm in having a fork that meets your needs. Or you can always make another gem that extends Machinist. (I'm encouraging the guys working on DataMapper support to make a machinist-dm gem, for example.) |
I would be nice to define named blueprints with regexp patterns. The actually blueprint name used could affect the behavior of the blueprint. For example,
Doing this with a pattern would allow for large classes of similar blueprints to be supported with very succinct definition. The blueprint for the above would look something like
Would a patch implementing this be accepted?
The text was updated successfully, but these errors were encountered: