Sha256: beb95853676c9c8a4663c57c3db8f9eca28be4d6aeba8a6e9ed07edfc3f6ae00

Contents?: true

Size: 573 Bytes

Versions: 2

Compression:

Stored size: 573 Bytes

Contents

# coding: utf-8

module Thinreports
  module Core::Shape

    class PageNumber::Format < Basic::Format
      config_reader :target
      config_reader default_format: %w( format )

      # For saving compatible 0.8.x format API
      config_reader overflow: %w( style overflow )

      def id
        @id ||= blank_value?(read('id')) ? self.class.next_default_id : read('id')
      end

      def for_report?
        blank_value?(target)
      end

      def self.next_default_id
        @id_counter ||= 0
        "__pageno#{@id_counter += 1}"
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thinreports-0.9.1 lib/thinreports/core/shape/page_number/format.rb
thinreports-0.9.0 lib/thinreports/core/shape/page_number/format.rb