lib/squib/deck.rb in squib-0.15.3 vs lib/squib/deck.rb in squib-0.16.0.pre.preview1
- old
+ new
@@ -31,11 +31,11 @@
# Delegate these configuration options to the Squib::Conf object
def_delegators :conf, :antialias, :backend, :count_format, :custom_colors, :dir,
:img_dir, :prefix, :text_hint, :typographer
# :nodoc:
# @api private
- attr_reader :layout, :conf, :dpi, :font
+ attr_reader :layout, :conf, :dpi, :font, :cell_px
#
# deck.size is really just @cards.size
def_delegators :cards, :size
@@ -61,16 +61,17 @@
def initialize(width: 825, height: 1125, cards: 1, dpi: 300, config: 'config.yml', layout: nil, &block)
@dpi = dpi
@font = DEFAULT_FONT
@cards = []
@conf = Conf.load(config)
+ @cell_px = @conf.cell_px
@progress_bar = Progress.new(@conf.progress_bars) # FIXME this is evil. Using something different with @ and non-@
show_info(config, layout)
- @width = Args::UnitConversion.parse width, dpi
- @height = Args::UnitConversion.parse height, dpi
+ @width = Args::UnitConversion.parse width, dpi, @cell_px
+ @height = Args::UnitConversion.parse height, dpi, @cell_px
cards.times{ |i| @cards << Squib::Card.new(self, @width, @height, i) }
- @layout = LayoutParser.new(dpi).load_layout(layout)
+ @layout = LayoutParser.new(dpi, @cell_px).load_layout(layout)
enable_groups_from_env!
if block_given?
instance_eval(&block) # here we go. wheeeee!
end
@cards.each { |c| c.finish! }
@@ -100,17 +101,38 @@
end
##################
### PUBLIC API ###
##################
- require_relative 'api/background'
- require_relative 'api/data'
- require_relative 'api/groups'
- require_relative 'api/image'
- require_relative 'api/save'
require_relative 'api/settings'
- require_relative 'api/shapes'
- require_relative 'api/text'
- require_relative 'api/units'
+ ###################
+ ### DSL METHODS ###
+ ###################
+ require_relative 'dsl/background'
+ require_relative 'dsl/circle'
+ require_relative 'dsl/csv'
+ require_relative 'dsl/curve'
+ require_relative 'dsl/cut_zone'
+ require_relative 'dsl/ellipse'
+ require_relative 'dsl/grid'
+ require_relative 'dsl/groups'
+ require_relative 'dsl/hand'
+ require_relative 'dsl/line'
+ require_relative 'dsl/png'
+ require_relative 'dsl/polygon'
+ require_relative 'dsl/rect'
+ require_relative 'dsl/safe_zone'
+ require_relative 'dsl/save_pdf'
+ require_relative 'dsl/save_png'
+ require_relative 'dsl/save_sheet'
+ require_relative 'dsl/save'
+ require_relative 'dsl/showcase'
+ require_relative 'dsl/star'
+ require_relative 'dsl/svg'
+ require_relative 'dsl/text'
+ require_relative 'dsl/triangle'
+ require_relative 'dsl/units'
+ require_relative 'dsl/xlsx'
+ require_relative 'dsl/yaml'
end
end