prawn 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake/testtask'
4
4
  require "rake/rdoctask"
5
5
  require "rake/gempackagetask"
6
6
 
7
- PRAWN_VERSION = "0.2.2"
7
+ PRAWN_VERSION = "0.2.3"
8
8
 
9
9
  task :default => [:test]
10
10
 
@@ -20,7 +20,7 @@ module Prawn
20
20
  # The base source directory for Prawn as installed on the system
21
21
  BASEDIR = File.expand_path(File.join(dir, '..'))
22
22
 
23
- VERSION = "0.2.2"
23
+ VERSION = "0.2.3"
24
24
 
25
25
  extend self
26
26
 
@@ -128,7 +128,7 @@ module Prawn
128
128
  # end
129
129
  #
130
130
  def canvas(&block)
131
- init_bounding_box(block) do |_|
131
+ init_bounding_box(block, :hold_position => true) do |_|
132
132
  @bounding_box = BoundingBox.new(self, [0,page_dimensions[3]],
133
133
  :width => page_dimensions[2],
134
134
  :height => page_dimensions[3]
@@ -168,14 +168,14 @@ module Prawn
168
168
 
169
169
  private
170
170
 
171
- def init_bounding_box(user_block, &init_block)
171
+ def init_bounding_box(user_block, options={}, &init_block)
172
172
  parent_box = @bounding_box
173
173
 
174
174
  init_block.call(parent_box)
175
175
 
176
176
  self.y = @bounding_box.absolute_top
177
177
  user_block.call
178
- self.y = @bounding_box.absolute_bottom
178
+ self.y = @bounding_box.absolute_bottom unless options[:hold_position]
179
179
 
180
180
  @bounding_box = parent_box
181
181
  end
@@ -127,3 +127,15 @@ describe "drawing bounding boxes" do
127
127
  end
128
128
 
129
129
  end
130
+
131
+ describe "A canvas" do
132
+ before(:each) { create_pdf }
133
+
134
+ it "should use whatever the last set y position is" do
135
+ @pdf.canvas do
136
+ @pdf.bounding_box([100,500],:width => 200) { @pdf.move_down 50 }
137
+ end
138
+ @pdf.y.should == 450
139
+ end
140
+ end
141
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Brown
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-17 00:00:00 -04:00
12
+ date: 2008-10-21 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15