Sha256: 5163c656044fa3ccc65c611ea36b078e72719865893b2c241646bca5d021cf4c

Contents?: true

Size: 501 Bytes

Versions: 3

Compression:

Stored size: 501 Bytes

Contents

module Languages
  class Epl2
    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
        "N\n"
      end

      def document_end
        "P1\n"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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