pos-printer 0.0.6 → 0.0.8

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 +11 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aabe35f769e81bdef27b1f4cbe58228b1775cddc0f316e48018460718c28875f
4
- data.tar.gz: 7046e3e0ea2e1a84e3ad588172256d5c726c3eb332b85eae13737f839703597d
3
+ metadata.gz: 8814a2ee3abe96a13570e49db9e156b4295a8fee944c752a7c0b85eacbc13781
4
+ data.tar.gz: 071beec002d4986cecf05d1c3c9baa09c5675f2ce700bec9a10606ba95b5d39f
5
5
  SHA512:
6
- metadata.gz: ec99f14f226ac84f86cc1d66f9b97fd01d9a1b3ca3bf70339524c345d8be59d60807b2ca6047bd6eaca94fd618c9aee39395da49c320ba85680004433ab6496e
7
- data.tar.gz: 64a81e4108759d37dda030a51e8913c3488e19be67df45f0b785fb77d9226b7fea2d24687ff9bde893e2262d63c230f67512a8c787593879d41504e86d2fd22a
6
+ metadata.gz: 2c528a5fbd0a995c465854e9ed322825afe6bcc7f5b9919f42aeef24f2fb651de2b2975539e65c0e4b06da229e27d85fa2664efa2f6a474d00c0587024b2dbe4
7
+ data.tar.gz: f8b88f459800ffd296a81c86bf9bf27a346d586adda749304257aa0027d90e5a7cc40a4d040d0100b932436f8a887fcfcbf30c95e3c91403dac0a7c0330d142c
@@ -44,8 +44,8 @@ module POS
44
44
  add_command "\x1d!\x11"
45
45
  end
46
46
 
47
- def line_feed
48
- add_command "\n"
47
+ def line_feed(n = 1)
48
+ add_command "\n" * n
49
49
  end
50
50
 
51
51
  def normal_size
@@ -67,10 +67,11 @@ module POS
67
67
  msb = s / 256
68
68
 
69
69
  add_command "\x1B\x61\x01"
70
- add_command "\x1D\x28\x6B\x03\x00\x31\x43#{qr_size.chr}"
70
+ add_command "\x1D\x28\x6B\x03\x00\x31\x43"
71
+ add_command qr_size.chr.force_encoding(Encoding::UTF_8)
71
72
  add_command "\x1D\x28\x6B\x03\x00\x31\x45\x33"
72
- add_command "\x1D\x28\x6B#{lsb.chr}"
73
- add_command "#{msb.chr}\x31\x50\x30"
73
+ add_command "\x1D\x28\x6B#{lsb.chr.force_encoding(Encoding::UTF_8)}"
74
+ add_command "#{msb.chr.force_encoding(Encoding::UTF_8)}\x31\x50\x30"
74
75
  add_command str
75
76
  add_command "\x1D\x28\x6B\x03\x00\x31\x51\x30"
76
77
  end
@@ -83,6 +84,11 @@ module POS
83
84
  add_command str
84
85
  end
85
86
 
87
+ def text_line(str)
88
+ add_command str
89
+ line_feed
90
+ end
91
+
86
92
  private
87
93
 
88
94
  def add_command(command)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pos-printer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusent Chig
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-02 00:00:00.000000000 Z
11
+ date: 2019-08-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Library for printing using ESC/POS (thermal) printers using CUPS.
14
14
  email: yusent@protonmail.com