Sha256: 4938a78a3788018a5b902c6dedc8d4900f757fa82b3c5e7cedc3f0facbd62862
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require_relative '../errors_warnings/warn_unexpected_params' module Squib class Deck def save_png(opts = {}) DSL::SavePNG.new(self, __callee__).run(opts) end end module DSL class SavePNG include WarnUnexpectedParams attr_reader :dsl_method, :deck def initialize(deck, dsl_method) @deck = deck @dsl_method = dsl_method @bar = deck.progress_bar end def self.accepted_params %i( range dir prefix suffix count_format rotate trim trim_radius ) end def run(opts) warn_if_unexpected opts Dir.chdir(deck.img_dir) do range = Args.extract_range opts, deck batch = Args.extract_save_batch opts, deck @bar.start("Saving PNGs to #{batch.summary}", deck.size) do |bar| range.map do |i| deck.cards[i].save_png(batch[i]) bar.increment end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
squib-0.16.0.pre.preview1 | lib/squib/dsl/save_png.rb |