lib/sapos/print/printer.rb in sapos-print-1.1.0 vs lib/sapos/print/printer.rb in sapos-print-1.1.1
- old
+ new
@@ -1,18 +1,20 @@
module Sapos
module Print
class Printer
+ attr_accessor :config
def initialize(config)
@config = config
end
def print(args = {})
raw_message = args[:document]
log_text = "id=#{args[:id]},doc=#{args[:document_number]},control=#{args[:print_control] ? "SI" : "NO"},cache=0\t"
+ log_text += "printer=#{args[:printer]}\t" if args[:printer]
filename = "#{args[:document_number]}.print" if args[:document_number]
filename = SecureRandom.hex if filename.nil?
result = false
raw = raw_message.force_encoding("UTF-8")
msgid = args[:id]
@@ -83,9 +85,10 @@
def send_to_printer(opts = {})
case @config.adapter
when 'console'
puts "=> CONSOLE: file: #{opts[:file]}<=\n\n"
+ puts "=> Printer: #{@config.printer}"
puts File.read(opts[:file])
puts "\n=> END CONSOLE =<"
return true
when 'cups'
file = opts.delete(:file)
\ No newline at end of file