Sha256: 3a16ac7060f413b0633806e828a2c4fc65815bbd369d42d400f5b2db5327a504

Contents?: true

Size: 1014 Bytes

Versions: 3

Compression:

Stored size: 1014 Bytes

Contents

require_relative '../args/card_range'
require_relative '../args/hand_special'
require_relative '../args/sheet'
require_relative '../errors_warnings/warn_unexpected_params'
require_relative '../graphics/hand'

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

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

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

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

      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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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