Class: Squib::DSL::SavePNG
- Inherits:
-
Object
- Object
- Squib::DSL::SavePNG
- Includes:
- WarnUnexpectedParams
- Defined in:
- lib/squib/dsl/save_png.rb
Instance Attribute Summary collapse
- #deck ⇒ Object readonly
- #dsl_method ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(deck, dsl_method) ⇒ SavePNG
constructor
A new instance of SavePNG.
- #run(opts) ⇒ Object
Methods included from WarnUnexpectedParams
Constructor Details
#initialize(deck, dsl_method) ⇒ SavePNG
Returns a new instance of SavePNG.
18 19 20 21 22 |
# File 'lib/squib/dsl/save_png.rb', line 18 def initialize(deck, dsl_method) @deck = deck @dsl_method = dsl_method @bar = deck. end |
Instance Attribute Details
#deck ⇒ Object (readonly)
16 17 18 |
# File 'lib/squib/dsl/save_png.rb', line 16 def deck @deck end |
#dsl_method ⇒ Object (readonly)
16 17 18 |
# File 'lib/squib/dsl/save_png.rb', line 16 def dsl_method @dsl_method end |
Class Method Details
.accepted_params ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/squib/dsl/save_png.rb', line 24 def self.accepted_params %i( range dir prefix suffix count_format rotate trim trim_radius shadow_offset_x shadow_offset_y shadow_radius shadow_color shadow_trim ) end |
Instance Method Details
#run(opts) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/squib/dsl/save_png.rb', line 33 def run(opts) warn_if_unexpected opts range = Args.extract_range opts, deck batch = Args.extract_save_batch opts, deck shadow = Args.extract_drop_shadow opts, deck @bar.start("Saving PNGs to #{batch.summary}", deck.size) do || range.map do |i| deck.cards[i].save_png(batch[i], shadow[i]) .increment end end end |