Class: Squib::DSL::Hand

Inherits:
Object
  • Object
show all
Includes:
WarnUnexpectedParams
Defined in:
lib/squib/dsl/hand.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) ⇒ Hand

Returns a new instance of Hand.



19
20
21
22
23
# File 'lib/squib/dsl/hand.rb', line 19

def initialize(deck, dsl_method)
  @deck = deck
  @dsl_method = dsl_method
  @bar = deck.progress_bar
end

Instance Attribute Details

#deckObject (readonly)



17
18
19
# File 'lib/squib/dsl/hand.rb', line 17

def deck
  @deck
end

#dsl_methodObject (readonly)



17
18
19
# File 'lib/squib/dsl/hand.rb', line 17

def dsl_method
  @dsl_method
end

Class Method Details

.accepted_paramsObject



25
26
27
28
29
30
31
# File 'lib/squib/dsl/hand.rb', line 25

def self.accepted_params
  %i(
    file dir range
    radius angle_range margin fill_color
    trim trim_radius
   )
end

Instance Method Details

#run(opts) ⇒ Object



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

def run(opts)
  warn_if_unexpected opts
  range = Args.extract_range opts, deck
  sheet = Args.extract_sheet opts, deck, {file: 'hand.png'}
  hand  = Args.extract_hand_special opts, deck
  deck.render_hand(range, sheet, hand)
end