Sha256: f03b234d35251a6f3ef8c9e901c59a2099de10c28dcb59458be5f6cb1ba1c441
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
require 'caracal/core/models/page_number_model' require 'caracal/errors' module Caracal module Core # This module encapsulates all the functionality related to setting the # document's page number behavior. # module PageNumbers def self.included(base) base.class_eval do #------------------------------------------------------------- # Configuration #------------------------------------------------------------- # constants const_set(:DEFAULT_PAGE_NUMBER_ALIGN, :center) # accessors attr_reader :page_number_show attr_reader :page_number_align #------------------------------------------------------------- # Public Methods #------------------------------------------------------------- # This method controls whether and how page numbers are displayed # on the document. # def page_numbers(show = nil, options = {}, &block) options.merge!({ show: !!show }) model = Caracal::Core::Models::PageNumberModel.new(options, &block) if model.valid? @page_number_show = model.page_number_show @page_number_align = model.page_number_align else raise Caracal::Errors::InvalidModelError, 'page_numbers :align parameter must be :left, :center, or :right' end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
caracal-0.1.1 | lib/caracal/core/page_numbers.rb |