Sha256: f81707d2042cf91521829ed5773d7ae74e33c775d7686adb74b2dab4bbef7dbd

Contents?: true

Size: 937 Bytes

Versions: 7

Compression:

Stored size: 937 Bytes

Contents

# frozen_string_literal: true

module Thinreports
  # @yield [config]
  # @yieldparam [Thinreports::Configuration] config
  def self.configure(&block)
    Thinreports.call_block_in(config, &block)
  end

  # @return [Thinreports::Configuration]
  def self.config
    @config ||= Thinreports::Configuration.new
  end

  class Configuration
    def initialize
      @fallback_fonts = []
    end

    # @return [Array<String>]
    # @example
    #   config.fallback_fonts # => ['Times New Roman', '/path/to/font.ttf']
    def fallback_fonts
      @fallback_fonts ||= []
    end

    # @param [Array<String>,String] font_names
    # @example
    #   config.fallback_fonts = 'Times New Roman'
    #   config.fallback_fonts = '/path/to/font.ttf'
    #   config.fallback_fonts = ['/path/to/font.ttf', 'IPAGothic']
    def fallback_fonts=(font_names)
      @fallback_fonts = font_names.is_a?(Array) ? font_names : [font_names]
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
thinreports-0.12.1 lib/thinreports/config.rb
thinreports-0.12.0 lib/thinreports/config.rb
thinreports-0.11.0 lib/thinreports/config.rb
thinreports-0.10.3 lib/thinreports/config.rb
thinreports-0.10.2 lib/thinreports/config.rb
thinreports-0.10.1 lib/thinreports/config.rb
thinreports-0.10.0 lib/thinreports/config.rb