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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pos/printer.rb +5 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6afeee00eef6bb42c4baa2855534d70e81a9a0c3cdac02eeb26937ecf64bca50
4
- data.tar.gz: 2f310c8be8b5290ea7134472752676c1dc6bf8ee71a7b988617a4ead37e1cc88
3
+ metadata.gz: b63feb4d4d3a88b207cc991abf0e247da64073e2f7f757d8e85ba2f498e83350
4
+ data.tar.gz: 18f61247016841eb2f6cd50490ab081ebeb245aea70b15b815233751f821384d
5
5
  SHA512:
6
- metadata.gz: e538880c88fb90c60e5ef6627afcdcc678fbb989e532353dfdac2d75a29d2e8aa04ac7e0ac8ff0d3e743711fbf6f34b994ecadffda298f8b117951315a0f2604
7
- data.tar.gz: 1ffe8c2e2a11ee862a9c7766ac870ebfb386d2349730f099a53236c21da0387a3d09fa531b123832a5313eaa2f71ab98632714ed1b56ca59f503bdb6b1178390
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
- attr_reader :name
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', '-d', @name, '-o', 'raw', stdin_data: commands)
22
+ Open3.capture3('lp', *@lp_options, stdin_data: commands)
24
23
  end
25
24
 
26
25
  # ESC/POS commands
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.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusent Chig