Implementing format strings for filename counts on multisaves
This commit is contained in:
@@ -25,14 +25,15 @@ module Squib
|
||||
# @option opts [Enumerable] range (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
|
||||
# @option opts [String] dir (_output) the directory for the output to be sent to. Will be created if it doesn't exist.
|
||||
# @option opts [String] prefix (card_) the prefix of the file name to be printed.
|
||||
# @option opts [String] count_format (%02d) the format string used for formatting the card count (e.g. padding zeros). Uses a Ruby format string (see the Ruby doc for Kernel::sprintf for specifics)
|
||||
# @option opts [Boolean, :clockwise, :counterclockwise] rotate (false) if true, the saved cards will be rotated 90 degrees clockwise. Or, rotate by the number of radians. Intended to rendering landscape instead of portrait.
|
||||
# @return [nil] Returns nothing
|
||||
# @api public
|
||||
def save_png(opts = {})
|
||||
opts = needs(opts,[:range, :creatable_dir, :prefix, :rotate])
|
||||
opts = needs(opts,[:range, :creatable_dir, :prefix, :count_format, :rotate])
|
||||
@progress_bar.start("Saving PNGs to #{opts[:dir]}/#{opts[:prefix]}*", @cards.size) do |bar|
|
||||
opts[:range].each do |i|
|
||||
@cards[i].save_png(i, opts[:dir], opts[:prefix], opts[:rotate], opts[:angle])
|
||||
@cards[i].save_png(i, opts[:dir], opts[:prefix], opts[:count_format], opts[:rotate], opts[:angle])
|
||||
bar.increment
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user