zebra-epl 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,7 @@ module Zebra
7
7
  class InvalidPrintDensityError < StandardError; end
8
8
  class PrintSpeedNotInformedError < StandardError; end
9
9
 
10
+ attr_writer :copies
10
11
  attr_reader :elements, :tempfile
11
12
  attr_accessor :width, :length, :gap, :print_speed, :print_density
12
13
 
@@ -30,6 +31,10 @@ module Zebra
30
31
  @print_density = d
31
32
  end
32
33
 
34
+ def copies
35
+ @copies || 1
36
+ end
37
+
33
38
  def <<(element)
34
39
  elements << element
35
40
  end
@@ -56,7 +61,7 @@ module Zebra
56
61
  io << element.to_epl << "\n"
57
62
  end
58
63
 
59
- io << "P0\n"
64
+ io << "P#{copies}\n"
60
65
  end
61
66
 
62
67
  def persist
@@ -1,5 +1,5 @@
1
1
  module Zebra
2
2
  module Epl
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -22,6 +22,16 @@ describe Zebra::Epl::Label do
22
22
  label.print_speed.should == 2
23
23
  end
24
24
 
25
+ it "sets the number of copies" do
26
+ label = described_class.new :copies => 4
27
+ label.copies.should == 4
28
+ end
29
+
30
+ it "the number of copies defaults to 1" do
31
+ label = described_class.new
32
+ label.copies.should == 1
33
+ end
34
+
25
35
  it "validates the printing speed" do
26
36
  [-1, 8, "a"].each do |s|
27
37
  expect {
@@ -63,7 +73,7 @@ describe Zebra::Epl::Label do
63
73
  label.print_speed = 3
64
74
  label.print_density = 10
65
75
  label.dump_contents(io)
66
- io.should == "O\nQ200,24\nq100\nS3\nD10\n\nN\nfoobar\nblabla\nP0\n"
76
+ io.should == "O\nQ200,24\nq100\nS3\nD10\n\nN\nfoobar\nblabla\nP1\n"
67
77
  end
68
78
 
69
79
  it "does not try to set the label width when it's not informed (falls back to autosense)" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zebra-epl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-10 00:00:00.000000000 Z
12
+ date: 2014-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cups
@@ -161,7 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
161
  segments:
162
162
  - 0
163
163
  version: '0'
164
- hash: 571588056673620876
164
+ hash: 892169269347069094
165
165
  required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  none: false
167
167
  requirements:
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  segments:
171
171
  - 0
172
172
  version: '0'
173
- hash: 571588056673620876
173
+ hash: 892169269347069094
174
174
  requirements: []
175
175
  rubyforge_project:
176
176
  rubygems_version: 1.8.24