Class: Zebra::PrintJob

Inherits:
Object
  • Object
show all
Defined in:
lib/zebra/print_job.rb

Defined Under Namespace

Classes: UnknownPrinter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(printer) ⇒ PrintJob

Returns a new instance of PrintJob.



11
12
13
14
15
# File 'lib/zebra/print_job.rb', line 11

def initialize(printer)
  check_existent_printers printer

  @printer = printer
end

Instance Attribute Details

#printerObject (readonly)

Returns the value of attribute printer.



9
10
11
# File 'lib/zebra/print_job.rb', line 9

def printer
  @printer
end

Instance Method Details



17
18
19
20
21
22
23
24
25
# File 'lib/zebra/print_job.rb', line 17

def print(label)
  tempfile = label.persist

  begin
    send_to_printer tempfile.path
  ensure
    tempfile.close
  end
end