Sha256: a5ecd88c9b345608b1defbe4dc3236d8d55ed919c501f6ece7cdec0aea5f34af

Contents?: true

Size: 461 Bytes

Versions: 2

Compression:

Stored size: 461 Bytes

Contents

module Languages
  class Zpl2
    class MergeFont
      def initialize
        @font_opts = []
      end

      def add(opts)
        font = Zpl2::Font.new(merge(opts))
        font.block!
        @font_opts.push(opts)
        font
      end

      def remove
        @font_opts.pop
        Zpl2::Font.new(merge({}))
      end

      private
      def merge(opts)
        r = @font_opts.reduce({},:merge) || {}
        r.merge(opts)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zebra_printer-0.9.0 lib/languages/zpl2/merge_font.rb
zebra_printer-0.8.0 lib/languages/zpl2/merge_font.rb