barby 0.4.1 → 0.4.2

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.
@@ -20,7 +20,7 @@ module Barby
20
20
 
21
21
  if barcode.two_dimensional?
22
22
  x, y = margin, margin
23
- booleans.reverse_each do |line|
23
+ booleans.each do |line|
24
24
  line.each do |bar|
25
25
  if bar
26
26
  x.upto(x+(xdim-1)) do |xx|
@@ -53,14 +53,19 @@ module Barby
53
53
  end
54
54
 
55
55
 
56
+ #Create a ChunkyPNG::Datastream containing the barcode image
57
+ #
58
+ # :constraints - Value is passed on to ChunkyPNG::Image#to_datastream
59
+ # E.g. to_datastream(:constraints => {:color_mode => ChunkyPNG::COLOR_GRAYSCALE})
56
60
  def to_datastream(*a)
57
- to_image.to_datastream
61
+ constraints = a.first && a.first[:constraints] ? [a.first[:constraints]] : []
62
+ to_image(*a).to_datastream(*constraints)
58
63
  end
59
64
 
60
65
 
61
66
  #Renders the barcode to a PNG image
62
67
  def to_png(*a)
63
- to_datastream.to_s
68
+ to_datastream(*a).to_s
64
69
  end
65
70
 
66
71
 
@@ -2,7 +2,7 @@ module Barby #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tore Darell
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-04 00:00:00 +02:00
18
+ date: 2010-10-08 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21