Sha256: 51af581df6d49b826b9bdf60a084899b1069a7af5b0ad671a2471f896fef04a2

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

require_relative '../errors_warnings/warn_unexpected_params'
require_relative '../args/card_range'
require_relative '../args/showcase_special'
require_relative '../args/sheet'

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

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

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

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