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

It'd be nice if the built-in layouts were specified a little differently in the code #389

Open
1 task
joem opened this issue Apr 24, 2024 · 0 comments
Open
1 task

Comments

@joem
Copy link

joem commented Apr 24, 2024

Is your feature request related to a problem? Please describe.

When looking at Squib example code, I'm often confused by what is a built-in layout and what isn't. I know there are only a few built-ins currently, but I'm not too good at remembering things I only use occasionally, so it get's confusing.

Describe the solution you'd like

I think it would be nice if the built-in layouts were specified as symbols instead of file names. Besides lessening confusion, this seems more Ruby-ish to me. So instead of something like Squib::Deck.new cards: 1, layout: 'hand.yml' do you'd have Squib::Deck.new cards: 1, layout: :hand do.

I imagine (but haven't checked yet) that the current code has multiple paths that it looks for specified layout files in (one of which is the /lib/squib/builtin/layouts/ directory of the Squib installation), and that's why you have to specify a full file name for built-ins. I think you could keep that (so you don't break older code) and add an additional check to see if the argument passed is a symbol, and if so, internally convert it to a file name and look for it only in the built-in's directory.

Describe alternatives you've considered

I'm not sure what a good alternative would be.

  • I might be interested in implementing this myself

Not sure I have time right now to try working on this, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant