Class: Squib::DSL::Showcase

Inherits:
Object
  • Object
show all
Includes:
WarnUnexpectedParams
Defined in:
lib/squib/dsl/showcase.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from WarnUnexpectedParams

#warn_if_unexpected

Constructor Details

#initialize(deck, dsl_method) ⇒ Showcase

Returns a new instance of Showcase.



18
19
20
21
# File 'lib/squib/dsl/showcase.rb', line 18

def initialize(deck, dsl_method)
  @deck = deck
  @dsl_method = dsl_method
end

Instance Attribute Details

#deckObject (readonly)



16
17
18
# File 'lib/squib/dsl/showcase.rb', line 16

def deck
  @deck
end

#dsl_methodObject (readonly)



16
17
18
# File 'lib/squib/dsl/showcase.rb', line 16

def dsl_method
  @dsl_method
end

Class Method Details

.accepted_paramsObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/squib/dsl/showcase.rb', line 23

def self.accepted_params
  %i(
    file dir
    trim trim_radius
    scale offset fill_color
    reflect_offset reflect_strength reflect_percent
    face margin
    range
   )
end

Instance Method Details

#run(opts) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/squib/dsl/showcase.rb', line 34

def run(opts)
  warn_if_unexpected opts
  range = Args.extract_range opts, deck
  showcase = Args.extract_showcase_special opts, deck
  sheet = Args.extract_sheet opts, deck, { file: 'showcase.png' }
  deck.render_showcase(range, sheet, showcase)
end