rescpos 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/rescpos/printer.rb +4 -3
- data/lib/rescpos/version.rb +1 -1
- data/spec/lib/rescpos/printer_spec.rb +3 -3
- metadata +18 -18
data/Gemfile.lock
CHANGED
data/lib/rescpos/printer.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
module Rescpos
|
2
2
|
class Printer
|
3
3
|
attr_reader :socket
|
4
|
+
SOCK_FLAG = 0
|
4
5
|
|
5
6
|
def initialize(ip, port)
|
6
7
|
@socket = TCPSocket.open(ip, port)
|
7
|
-
@socket.send("\x1b\x40",
|
8
|
+
@socket.send("\x1b\x40", SOCK_FLAG)
|
8
9
|
end
|
9
10
|
|
10
11
|
def self.open(ip, port)
|
@@ -17,7 +18,7 @@ module Rescpos
|
|
17
18
|
|
18
19
|
def print(content, opts={:encoding => 'GBK'})
|
19
20
|
content = Iconv.iconv("#{opts[:encoding]}//IGNORE","UTF-8//IGNORE", content)[0]
|
20
|
-
@socket.send(content,
|
21
|
+
@socket.send(content, SOCK_FLAG)
|
21
22
|
cut
|
22
23
|
end
|
23
24
|
|
@@ -27,7 +28,7 @@ module Rescpos
|
|
27
28
|
|
28
29
|
private
|
29
30
|
def send_command(command)
|
30
|
-
@socket.send(command,
|
31
|
+
@socket.send(command, SOCK_FLAG)
|
31
32
|
end
|
32
33
|
|
33
34
|
def cut
|
data/lib/rescpos/version.rb
CHANGED
@@ -13,7 +13,7 @@ module Rescpos
|
|
13
13
|
describe Printer do
|
14
14
|
before(:each) do
|
15
15
|
TCPSocket.should_receive(:open).with("192.168.1.3", 9100).and_return(socket)
|
16
|
-
socket.should_receive(:send).with("\x1b\x40",
|
16
|
+
socket.should_receive(:send).with("\x1b\x40", 0)
|
17
17
|
end
|
18
18
|
|
19
19
|
let(:socket) { Object.new }
|
@@ -25,7 +25,7 @@ module Rescpos
|
|
25
25
|
it "prints the a rendered report" do
|
26
26
|
printer = Printer.open("192.168.1.3", 9100)
|
27
27
|
|
28
|
-
socket.should_receive(:send).with("A title",
|
28
|
+
socket.should_receive(:send).with("A title", 0)
|
29
29
|
printer.should_receive(:cut)
|
30
30
|
printer.print(TitledReport.new("A title").render(:template => "<%= @title %>"))
|
31
31
|
end
|
@@ -36,7 +36,7 @@ module Rescpos
|
|
36
36
|
end
|
37
37
|
printer = Printer.open("192.168.1.3", 9100)
|
38
38
|
|
39
|
-
socket.should_receive(:send).with("A title\n",
|
39
|
+
socket.should_receive(:send).with("A title\n", 0)
|
40
40
|
printer.should_receive(:cut)
|
41
41
|
printer.print_report(TitledReport.new("A title"))
|
42
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rescpos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09
|
12
|
+
date: 2011-10-09 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rb-inotify
|
16
|
-
requirement: &
|
16
|
+
requirement: &70517850 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70517850
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: libnotify
|
27
|
-
requirement: &
|
27
|
+
requirement: &70517630 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70517630
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec-instafail
|
38
|
-
requirement: &
|
38
|
+
requirement: &70517380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70517380
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: cucumber
|
49
|
-
requirement: &
|
49
|
+
requirement: &70517070 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70517070
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &70516750 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70516750
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard-bundler
|
71
|
-
requirement: &
|
71
|
+
requirement: &70516440 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70516440
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: guard-cucumber
|
82
|
-
requirement: &
|
82
|
+
requirement: &70516120 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70516120
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: guard-rspec
|
93
|
-
requirement: &
|
93
|
+
requirement: &70515790 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70515790
|
102
102
|
description: Print formatted docs with Winpos WP-800
|
103
103
|
email:
|
104
104
|
- towerhe@gmail.com
|