escper 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,14 @@
1
1
  module Escper
2
2
  class Asciifier
3
- def initialize(codepage)
3
+ def initialize(codepage=0)
4
4
  @codepage = codepage
5
5
  @codepage_lookup_yaml = YAML::load(File.read(Escper.codepage_file))
6
6
  end
7
7
 
8
8
  def self.all_chars
9
9
  out = "\e@" # Initialize Printer
10
- out.encode!('ascii-8bit')
10
+ out.encode!('ASCII-8BIT')
11
11
  20.upto(255) { |i| out += i.to_s(16) + i.chr + ' ' }
12
- out += "\n\n\n\n\n\n" +
13
- "\x1D\x56\x00" # paper cut
14
12
  return out
15
13
  end
16
14
 
@@ -44,7 +44,7 @@ module Escper
44
44
  return bytes_written, output_text
45
45
  end
46
46
 
47
- def merge_texts(text, raw_text_insertations, codepage)
47
+ def self.merge_texts(text, raw_text_insertations, codepage = 0)
48
48
  asciifier = Escper::Asciifier.new(codepage)
49
49
  asciified_text = asciifier.process(text)
50
50
  raw_text_insertations.each do |key, value|
@@ -70,7 +70,7 @@ module Escper
70
70
 
71
71
  ActiveRecord::Base.logger.info "[PRINTING] Testing #{value[:device].inspect }"
72
72
  if chartest
73
- print(id, init + self.all_chars + cut)
73
+ print(id, init + Escper::Asciifier.all_chars + cut)
74
74
  else
75
75
  ascifiier = Escper::Asciifier.new(value[:codepage])
76
76
  print(id, init + ascifiier.process(testtext) + cut)
@@ -1,3 +1,3 @@
1
1
  module Escper
2
- VERSION = "1.0.7"
2
+ VERSION = "1.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: escper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: