Class: Squib::DSL::Curve

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

Returns a new instance of Curve.



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

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

Instance Attribute Details

#deckObject (readonly)



13
14
15
# File 'lib/squib/dsl/curve.rb', line 13

def deck
  @deck
end

#dsl_methodObject (readonly)



13
14
15
# File 'lib/squib/dsl/curve.rb', line 13

def dsl_method
  @dsl_method
end

Class Method Details

.accepted_paramsObject



20
21
22
23
24
# File 'lib/squib/dsl/curve.rb', line 20

def self.accepted_params
  %i(x1 y1 x2 y2 cx1 cy1 cx2 cy2
     fill_color stroke_color stroke_width stroke_strategy join dash cap
     range layout)
end

Instance Method Details

#run(opts) ⇒ Object



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

def run(opts)
  warn_if_unexpected opts
  range = Args.extract_range opts, deck
  draw  = Args.extract_draw opts, deck
  coords   = Args.extract_coords opts, deck
  range.each { |i| deck.cards[i].curve(coords[i], draw[i]) }
end