Module: Escper

Defined in:
lib/escper.rb,
lib/escper/log.rb,
lib/escper/image.rb,
lib/escper/printer.rb,
lib/escper/version.rb,
lib/escper/asciifier.rb,
lib/escper/vendor_printer.rb

Defined Under Namespace

Classes: Asciifier, Img, Printer, VendorPrinter

Constant Summary collapse

VERSION =
"1.2.1"
@@codepage_file =
File.join(File.dirname(__FILE__), 'escper', 'codepages.yml')
@@use_safe_device_path =
false
@@safe_device_path =
File.join('/','tmp')

Class Method Summary collapse

Class Method Details

.codepage_fileObject

mattr_accessor :codepage_file, :use_safe_device_path, :safe_device_path



13
14
15
# File 'lib/escper.rb', line 13

def self.codepage_file
  @@codepage_file
end

.codepage_file=(codepage_file) ⇒ Object



17
18
19
# File 'lib/escper.rb', line 17

def self.codepage_file=(codepage_file)
  @@codepage_file = codepage_file
end

.log(text) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/escper/log.rb', line 2

def self.log(text)
  if defined?(ActiveRecord)
    ActiveRecord::Base.logger.info text
  else
    puts text
  end
end

.safe_device_pathObject



29
30
31
# File 'lib/escper.rb', line 29

def self.safe_device_path
  @@safe_device_path
end

.safe_device_path=(safe_device_path) ⇒ Object



33
34
35
# File 'lib/escper.rb', line 33

def self.safe_device_path=(safe_device_path)
  @@safe_device_path = safe_device_path
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Escper)

    the object that the method was called on



41
42
43
# File 'lib/escper.rb', line 41

def self.setup
  yield self
end

.use_safe_device_pathObject



21
22
23
# File 'lib/escper.rb', line 21

def self.use_safe_device_path
  @@use_safe_device_path
end

.use_safe_device_path=(use_safe_device_path) ⇒ Object



25
26
27
# File 'lib/escper.rb', line 25

def self.use_safe_device_path=(use_safe_device_path)
  @@use_safe_device_path = use_safe_device_path
end