pos-printer 0.0.1 → 0.0.2
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 +7 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6afeee00eef6bb42c4baa2855534d70e81a9a0c3cdac02eeb26937ecf64bca50
|
4
|
+
data.tar.gz: 2f310c8be8b5290ea7134472752676c1dc6bf8ee71a7b988617a4ead37e1cc88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e538880c88fb90c60e5ef6627afcdcc678fbb989e532353dfdac2d75a29d2e8aa04ac7e0ac8ff0d3e743711fbf6f34b994ecadffda298f8b117951315a0f2604
|
7
|
+
data.tar.gz: 1ffe8c2e2a11ee862a9c7766ac870ebfb386d2349730f099a53236c21da0387a3d09fa531b123832a5313eaa2f71ab98632714ed1b56ca59f503bdb6b1178390
|
data/lib/pos/printer.rb
CHANGED
@@ -4,6 +4,12 @@ module POS
|
|
4
4
|
class Printer
|
5
5
|
attr_reader :name
|
6
6
|
|
7
|
+
def self.print(printer_name)
|
8
|
+
printer = self.new(printer_name)
|
9
|
+
yield printer
|
10
|
+
printer.print
|
11
|
+
end
|
12
|
+
|
7
13
|
def initialize(name)
|
8
14
|
@name = name
|
9
15
|
@commands = '\e@' # This is ESC/POS initialize command.
|
@@ -14,7 +20,7 @@ module POS
|
|
14
20
|
end
|
15
21
|
|
16
22
|
def print
|
17
|
-
|
23
|
+
Open3.capture3('lp', '-d', @name, '-o', 'raw', stdin_data: commands)
|
18
24
|
end
|
19
25
|
|
20
26
|
# ESC/POS commands
|
@@ -73,9 +79,5 @@ module POS
|
|
73
79
|
@commands << command
|
74
80
|
return
|
75
81
|
end
|
76
|
-
|
77
|
-
def send_to_printer
|
78
|
-
Open3.capture3('lp', '-d', @name, '-o', 'raw', stdin_data: commands)
|
79
|
-
end
|
80
82
|
end
|
81
83
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pos-printer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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-07-
|
11
|
+
date: 2019-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Library for printing using ESC/POS (thermal) printers.
|
13
|
+
description: Library for printing using ESC/POS (thermal) printers using CUPS.
|
14
14
|
email: yusent@protonmail.com
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
@@ -40,5 +40,5 @@ requirements: []
|
|
40
40
|
rubygems_version: 3.0.4
|
41
41
|
signing_key:
|
42
42
|
specification_version: 4
|
43
|
-
summary: Library for printing using ESC/POS (thermal) printers.
|
43
|
+
summary: Library for printing using ESC/POS (thermal) printers using CUPS.
|
44
44
|
test_files: []
|