squib
squib copied to clipboard
Add "default" method that sets a given argument's default
As helpful as layouts are, it would be nice if we had the ability to set some defaults for the entire deck. This is what I was kind of going for with the set
method, although I punted on that.
So the syntax would be something like this:
Squib::Deck.new do
default trim: '0.25in'
save_png prefix: "finished_" # trim is now 0.25in instead of 0
save_sheet # trim is now 0.25in instead of 0
save_png prefix: "full_", trim: 0 # trim is 0
end
The main issue here is where this fits in order of precedence with layouts. My gut reaction is that a default
is overridden by a layout because layouts are explicitly used.
And by the way, we can remove the set
once this works. The font behavior should be inline with this, instead of being ad hoc
In the commit I just pushed, I added the ability for the "rect" method to make use of a default. It would be overriden by the given layout - and I like that. Layouts are still specified in the DSL call itself, so you are explicitly asking to use it.
The args code will need some refactoring in prep for this, though. Too many arguments to load!
- maybe created a Deck.loader_context
that has everything we need? (size, dpi, defaults, layout, etc.)
Been working on this one lately. It's awesome and relatively easy to implement. But, making this work means changing a lot of calls in a lot of places to have (yet another) argument. This warrants a big refactoring - which is a good thing to do - but I want to do that refactoring before actually doing this feature.
With this feature, however, we can start to have preset templates for decks. This would mean that you can have a set of defaults based on a given template, including a default set of layouts and whatnot. For example, TGC's poker card could have a default trim
of 37.5
, proper width and height, etc.