pos-printer 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pos/printer.rb +5 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b63feb4d4d3a88b207cc991abf0e247da64073e2f7f757d8e85ba2f498e83350
|
4
|
+
data.tar.gz: 18f61247016841eb2f6cd50490ab081ebeb245aea70b15b815233751f821384d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c9242ed8be3cf7e98ffb27a5af856d0c9c0b77fb20e8c0a098f47a53fe775bcf546a8b635f9775d65b5b6d80b56a45d998de1a847b86b78516ce9ecc7300872
|
7
|
+
data.tar.gz: 8e289107e7c0932ced6af88b1261d521737d7956d17f1917860f4d1067d1d78d6a3f23734ef38fd5f299f666a8311673eeb9db91214433fcb96b0af560fb9b96
|
data/lib/pos/printer.rb
CHANGED
@@ -2,17 +2,16 @@ require 'open3'
|
|
2
2
|
|
3
3
|
module POS
|
4
4
|
class Printer
|
5
|
-
|
6
|
-
|
7
|
-
def self.print(printer_name)
|
8
|
-
printer = self.new(printer_name)
|
5
|
+
def self.print(printer_name, lp_options: [])
|
6
|
+
printer = self.new(printer_name, lp_options)
|
9
7
|
yield printer
|
10
8
|
printer.print
|
11
9
|
end
|
12
10
|
|
13
|
-
def initialize(name)
|
11
|
+
def initialize(name, lp_options = [])
|
14
12
|
@name = name
|
15
13
|
@commands = '\e@' # This is ESC/POS initialize command.
|
14
|
+
@lp_options = ['-d', name, '-o', 'raw', *lp_options]
|
16
15
|
end
|
17
16
|
|
18
17
|
def commands
|
@@ -20,7 +19,7 @@ module POS
|
|
20
19
|
end
|
21
20
|
|
22
21
|
def print
|
23
|
-
Open3.capture3('lp',
|
22
|
+
Open3.capture3('lp', *@lp_options, stdin_data: commands)
|
24
23
|
end
|
25
24
|
|
26
25
|
# ESC/POS commands
|