rescpos 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rescpos (0.0.3)
4
+ rescpos (0.0.6)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -57,10 +57,12 @@ module Rescpos
57
57
  command << position.chr
58
58
  end
59
59
  command << "\x00"
60
- table.headers.each do |header|
61
- command << header << "\x09"
60
+ if table.headers
61
+ table.headers.each do |header|
62
+ command << header << "\x09"
63
+ end
64
+ command << "\n"
62
65
  end
63
- command << "\n"
64
66
  table.data.each do |item|
65
67
  table.keys.each do |key|
66
68
  if item.is_a? Hash
@@ -69,7 +71,7 @@ module Rescpos
69
71
  command << "#{item.send(key)}"+"\x09"
70
72
  end
71
73
  end
72
- if table.data.at(-1) == item
74
+ if table.data.last == item
73
75
  return command
74
76
  end
75
77
  command << "\n"
@@ -1,3 +1,3 @@
1
1
  module Rescpos
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -69,6 +69,29 @@ describe ReportUtilTest do
69
69
  table.should == "\x1b\x44#{9.chr}\x00a\x09b\x09\na\x092\x09"
70
70
  end
71
71
 
72
+ it "give a hash should return a table without a header" do
73
+ bill_item = {
74
+ :name => 'a',
75
+ :quantity => 2,
76
+ }
77
+ table = @report_util.table([bill_item]) do |t|
78
+ t.config([9])
79
+ t.td([:name, :quantity])
80
+ end
81
+ table.should == "\x1b\x44#{9.chr}\x00a\x092\x09"
82
+ end
83
+
84
+ it "give a object should return a table without a header" do
85
+ bill_item = BillItem.new
86
+ bill_item.name = 'a'
87
+ bill_item.quantity = 2
88
+ table = @report_util.table([bill_item]) do |t|
89
+ t.config([9])
90
+ t.td([:name, :quantity])
91
+ end
92
+ table.should == "\x1b\x44#{9.chr}\x00a\x092\x09"
93
+ end
94
+
72
95
  it "give a object should return a table" do
73
96
  bill_item = BillItem.new
74
97
  bill_item.name = 'a'
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.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-07 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb-inotify
16
- requirement: &83465280 !ruby/object:Gem::Requirement
16
+ requirement: &71073970 !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: *83465280
24
+ version_requirements: *71073970
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: libnotify
27
- requirement: &83464000 !ruby/object:Gem::Requirement
27
+ requirement: &71073520 !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: *83464000
35
+ version_requirements: *71073520
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec-instafail
38
- requirement: &83463570 !ruby/object:Gem::Requirement
38
+ requirement: &71072940 !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: *83463570
46
+ version_requirements: *71072940
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cucumber
49
- requirement: &83462720 !ruby/object:Gem::Requirement
49
+ requirement: &71072170 !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: *83462720
57
+ version_requirements: *71072170
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &83462030 !ruby/object:Gem::Requirement
60
+ requirement: &71071470 !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: *83462030
68
+ version_requirements: *71071470
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-bundler
71
- requirement: &83460930 !ruby/object:Gem::Requirement
71
+ requirement: &71070320 !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: *83460930
79
+ version_requirements: *71070320
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: guard-cucumber
82
- requirement: &83460340 !ruby/object:Gem::Requirement
82
+ requirement: &71069630 !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: *83460340
90
+ version_requirements: *71069630
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: guard-rspec
93
- requirement: &83459550 !ruby/object:Gem::Requirement
93
+ requirement: &71068850 !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: *83459550
101
+ version_requirements: *71068850
102
102
  description: Print formatted docs with Winpos WP-800
103
103
  email:
104
104
  - towerhe@gmail.com