pos-printer 0.0.0 → 0.0.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pos/printer.rb +17 -12
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a81deb18dc1b0e225693bc03268a1049ee858e286e680b96d5c2ec0db840586
4
- data.tar.gz: 89a9bea250e31741189bb2bb1a1699b522feb028e85d5db858db1df5cf249b4f
3
+ metadata.gz: 6c84647150038a2e3159fc0ff1a32765a37dc5cce29d51d4496bffbbdfa497b9
4
+ data.tar.gz: fe59275b8c5fb1cf1ac845ad82c6db02d6882a727ae235b04398384031a97f66
5
5
  SHA512:
6
- metadata.gz: f3a2094564d93495e887bd7066df930214c8eb67771c4d15af5d75530db544ddab90de98a3f8dbacd189578bb47330f71291a0ae2997f15fe240c7d826299c2a
7
- data.tar.gz: c44950161d8509ec2d6f6d3d27189416a90d243ca748781ce8f049c42cb4e138010251ac4f5be4dd3aecaca3930cf356bbf5461180a9aa0df54fdf63c1d6e403
6
+ metadata.gz: ce3a614f32f3796a323d22c696e7838d967d0aa3ef7079869bbf59921f3e1e23c23199f20613efe69c7a8d3f563808659de232b082e874aba7c6cb4bbcfd953a
7
+ data.tar.gz: 70da9c12fca86e5859d5662dd10dfe2d0bd8238a1cb3072279b4e8472776f8fd9f75a8eb80fc62e4f2378b5294051e08dd2d1826c48c7e681188bd2db28f6c25
data/lib/pos/printer.rb CHANGED
@@ -20,55 +20,60 @@ module POS
20
20
  # ESC/POS commands
21
21
 
22
22
  def align_center
23
- @commands << '\ea\1'
23
+ add_command '\ea\1'
24
24
  end
25
25
 
26
26
  def align_left
27
- @commands << '\ea\0'
27
+ add_command '\ea\0'
28
28
  end
29
29
 
30
30
  def align_right
31
- @commands << '\ea\2'
31
+ add_command '\ea\2'
32
32
  end
33
33
 
34
34
  def big_font
35
- @commands << '\eM\0'
35
+ add_command '\eM\0'
36
36
  end
37
37
 
38
38
  def cut
39
- @commands << '\em'
39
+ add_command '\em'
40
40
  end
41
41
 
42
42
  def double_size
43
- @commands << '\x1d!\x11'
43
+ add_command '\x1d!\x11'
44
44
  end
45
45
 
46
46
  def line_feed
47
- @commands << '\n'
47
+ add_command '\n'
48
48
  end
49
49
 
50
50
  def normal_size
51
- @commands << '\x1d!\0'
51
+ add_command '\x1d!\0'
52
52
  end
53
53
 
54
54
  def open_drawer
55
- @commands << '\x1bp\x00\x19\xff\x1bp\x01\x19\xff'
55
+ add_command '\x1bp\x00\x19\xff\x1bp\x01\x19\xff'
56
56
  end
57
57
 
58
58
  def print_logo
59
- @commands << '\x1cp\1\0'
59
+ add_command '\x1cp\1\0'
60
60
  end
61
61
 
62
62
  def small_font
63
- @commands << '\eM\1'
63
+ add_command '\eM\1'
64
64
  end
65
65
 
66
66
  def text(str)
67
- @commands << str
67
+ add_command str
68
68
  end
69
69
 
70
70
  private
71
71
 
72
+ def add_command(command)
73
+ @commands << command
74
+ return
75
+ end
76
+
72
77
  def send_to_printer
73
78
  Open3.capture3('lp', '-d', @name, '-o', 'raw', stdin_data: commands)
74
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pos-printer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusent Chig