Method: Printr::Machine#direct_write

Defined in:
lib/printr.rb

#direct_write(file_path, text) ⇒ Object



140
141
142
143
144
145
146
147
148
149
150
# File 'lib/printr.rb', line 140

def direct_write(file_path,text)
  begin
    File.open(file_path,'w:ISO8859-15') do |f|
      Printr.log "[Printr] Writing text."
      text.force_encoding 'ISO-8859-15'
      f.write text
    end
  rescue Exception => e
    Printr.log "[Printr] Failed to open #{file_path} as a File. #{e.inspect}"
  end
end