Sha256: 26348d8c796500704c6496c53dfb7966f769ee7f3b60d5fe308a72e03b0d388a
Contents?: true
Size: 707 Bytes
Versions: 1
Compression:
Stored size: 707 Bytes
Contents
module Zebra class PrintJob class UnknownPrinter < StandardError def initialize(printer) super("Could not find a printer named #{printer}") end end attr_reader :printer def initialize(printer) check_existent_printers printer @printer = printer end def print(label) tempfile = label.persist begin `lpr -P #{@printer} -o raw #{tempfile.path}` ensure tempfile.close tempfile.unlink end end private def check_existent_printers(printer) existent_printers = Cups.show_destinations raise UnknownPrinter.new(printer) unless existent_printers.include?(printer) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zebra-epl-0.0.2 | lib/zebra/print_job.rb |