Sha256: 64bd77a234163c7cc5b494115130b0474faca3f55b0d4ca5e1ae7629efee4cb7

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Asciidoctor
  module PDF
    class ThemeData
      attr_reader :table

      def initialize data = nil
        @table = (data || {}).transform_keys(&:to_sym)
      end

      def [] name
        @table[name.to_sym]
      end

      def []= name, value
        @table[name.to_sym] = value
      end

      def each_pair &block
        @table.each_pair(&block)
      end

      def eql? other
        @table.to_h.eql? other.to_h
      end

      def delete_field name
        @table.delete name
      end

      def dup
        ThemeData.new @table
      end

      def method_missing name, *args
        if (name_str = name.to_s).end_with? '='
          @table[name_str.chop.to_sym] = args[0]
        else
          @table[name]
        end
      end

      def respond_to? name, _include_all = false
        @table.key? name.to_sym
      end

      def respond_to_missing? name, _include_all = false
        @table.key? name.to_sym
      end

      def to_h
        @table
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asciidoctor-pdf-2.3.19 lib/asciidoctor/pdf/theme_data.rb