Sha256: f35d0a32947dbaf37166f1243d25245d4210414181cfdbbfbda739cac747da5e

Contents?: true

Size: 997 Bytes

Versions: 3

Compression:

Stored size: 997 Bytes

Contents

require_relative '../errors_warnings/warn_unexpected_params'
require_relative '../args/card_range'
require_relative '../args/coords'
require_relative '../args/draw'

module Squib
  class Deck
    def circle(opts = {})
      DSL::Circle.new(self, __callee__).run(opts)
    end
  end

  module DSL
    class Circle
      include WarnUnexpectedParams
      attr_reader :dsl_method, :deck

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

      def self.accepted_params
        %i(x y
           radius arc_start arc_end arc_direction arc_close
           fill_color stroke_color stroke_width stroke_strategy join dash cap
           range layout)
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
squib-0.19.0 lib/squib/dsl/circle.rb
squib-0.19.0b lib/squib/dsl/circle.rb
squib-0.19.0a lib/squib/dsl/circle.rb