Class: Squib::DSL::SVG
- Inherits:
-
Object
- Object
- Squib::DSL::SVG
- Includes:
- WarnUnexpectedParams
- Defined in:
- lib/squib/dsl/svg.rb
Instance Attribute Summary collapse
- #deck ⇒ Object readonly
- #dsl_method ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(deck, dsl_method) ⇒ SVG
constructor
A new instance of SVG.
- #run(opts) ⇒ Object
Methods included from WarnUnexpectedParams
Constructor Details
#initialize(deck, dsl_method) ⇒ SVG
Returns a new instance of SVG.
21 22 23 24 |
# File 'lib/squib/dsl/svg.rb', line 21 def initialize(deck, dsl_method) @deck = deck @dsl_method = dsl_method end |
Instance Attribute Details
#deck ⇒ Object (readonly)
19 20 21 |
# File 'lib/squib/dsl/svg.rb', line 19 def deck @deck end |
#dsl_method ⇒ Object (readonly)
19 20 21 |
# File 'lib/squib/dsl/svg.rb', line 19 def dsl_method @dsl_method end |
Class Method Details
.accepted_params ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/squib/dsl/svg.rb', line 26 def self.accepted_params %i( file x y width height blend mask crop_x crop_y crop_width crop_height crop_corner_radius crop_corner_x_radius crop_corner_y_radius flip_horizontal flip_vertical angle id force_id data range layout placeholder ) end |
Instance Method Details
#run(opts) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/squib/dsl/svg.rb', line 40 def run(opts) warn_if_unexpected opts Dir.chdir(deck.img_dir) do range = Args.extract_range opts, deck paint = Args.extract_paint opts, deck box = Args.extract_scale_box opts, deck trans = Args.extract_transform opts, deck ifile = Args.extract_input_file opts, deck svg_args = Args.extract_svg_special opts, deck deck..start('Loading PNG(s)', range.size) do || range.each do |i| if svg_args.render?(i) deck.cards[i].svg(ifile[i].file, svg_args[i], box[i], paint[i], trans[i]) end .increment end end end end |