Sha256: ead5105f590cfa0acfb0f425387772c4c75f0ae984c339d95d39e57c34c38f96

Contents?: true

Size: 914 Bytes

Versions: 5

Compression:

Stored size: 914 Bytes

Contents

# frozen_string_literal: true

module Thinreports
  # @yield [config]
  # @yieldparam [Thinreports::Configuration] config
  def self.configure(&block)
    block.call(config)
  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

5 entries across 5 versions & 1 rubygems

Version Path
thinreports-0.14.2 lib/thinreports/config.rb
thinreports-0.14.1 lib/thinreports/config.rb
thinreports-0.14.0 lib/thinreports/config.rb
thinreports-0.13.1 lib/thinreports/config.rb
thinreports-0.13.0 lib/thinreports/config.rb