Sha256: cfe58f73a55635c29a9869dd947f453a510df830b239fd552336f802e9d0e345

Contents?: true

Size: 506 Bytes

Versions: 3

Compression:

Stored size: 506 Bytes

Contents

module Languages
  class Zpl2
    class Document
      def initialize
        @document = document_start.concat "\n"
      end
      
      def <<(obj)
        string = obj.is_a?(String) ? obj : obj.render
        string.concat "\n" unless string.end_with? "\n"
        @document.concat string
      end

      def render
        @document.concat(document_end).concat("\n")
      end
      
      def document_start
        "^XA"
      end

      def document_end
        "^XZ"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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