Generate unique address#7
Conversation
|
Also, to clarify, this is only done for one method at the moment. I'll expand it to work with all classes and modularize when the approach is settled. |
|
Thanks for your contribution 🎉Looks nice. I can't find a different solution, it is ok for me 👍 |
42059c6 to
0718905
Compare
0718905 to
5e4fc75
Compare
|
Ok. Thanks. I'm making progress on this, but I have to determine how to build a macro that will allow an arbitrary number of arguments to be passed through it. I now have each of the builders inherit from |
|
This would be really nice to get merged in if it's working |
|
Super funny, I was thinking about Crystal earlier today (before this request was made). Let me see if I can work in trying to make this work for all/most of the methods and go from there. I'm not sure I actually think this is really the most idiomatic way to do this with a typed language, but it's worth it to have the feature working for people at this time. |
|
I worked on this a bit last night and have something that kinda works. Can I get a review @askn? I think I've got an issue where my macro doesn't actually pass in the arguments to the non-uniqued version. Do you know macros well enough to determine how to do this properly? |
|
@askn Do you have time to review and merge or provide feedback? |

This is a WIP branch that generates unique values similar to how the ruby gem provides unique values.
I'm not sure I like this approach but it's the only thing I could come up with.
The API will expand to provide
unique_*methods. (e.g.Faker::Address.cityandFaker::Address.unique_city)I use a crystal macro to generate both versions. Can you give this a review @askn and see if you like this approach? If not, can you share an alternative approach that might be better and I can investigate or submit another PR?
When complete, this will fix #4