public
Description: Fast, Nimble PDF Writer for Ruby
Homepage: http://prawn.lighthouseapp.com/projects/9398/home
Clone URL: git://github.com/sandal/prawn.git
Begin work on API docs (Document) [#26 state:open]
sandal (author)
Thu Jun 26 14:16:02 -0700 2008
commit  21d711571b3d87953e5f2ce6b1ca71a2ad58d788
tree    f6ff01a090cace839a5819d8113b4418db71b81f
parent  efe778afb9d4af4296c26b360f3361a228a8c1a8
...
1
2
3
 
4
5
6
...
16
17
18
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
...
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
0
@@ -1,6 +1,7 @@
0
 require 'rubygems'
0
 require 'rake'
0
 require 'spec/rake/spectask'
0
+require "rake/rdoctask"
0
 
0
 task :default => [:spec]
0
 
0
@@ -16,3 +17,15 @@ task :stats do
0
    ["Specs", "spec"] ).to_s
0
 end
0
 
0
+desc "genrates documentation"
0
+Rake::RDocTask.new do |rdoc|
0
+ rdoc.rdoc_files.include( "README",
0
+ "COPYING",
0
+ "LICENSE", "lib/" )
0
+ rdoc.main = "README"
0
+ rdoc.rdoc_dir = "doc/html"
0
+ rdoc.title = "Prawn Documentation"
0
+end
0
+
0
+
0
+
...
95
96
97
98
 
99
100
101
...
129
130
131
132
 
133
134
135
...
159
160
161
 
 
162
163
164
165
 
 
166
167
168
169
 
 
 
 
 
 
 
 
 
170
171
172
173
174
 
 
 
 
 
 
 
 
175
176
177
178
179
 
 
 
 
 
 
 
 
 
180
181
182
183
184
185
 
 
 
 
 
 
 
 
 
 
 
186
187
188
189
190
191
192
 
 
 
 
193
194
195
...
95
96
97
 
98
99
100
101
...
129
130
131
 
132
133
134
135
...
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
 
 
 
231
232
233
234
235
236
237
0
@@ -95,7 +95,7 @@ module Prawn
0
             
0
      # Creates and advances to a new page in the document.
0
      # Runs the <tt>:on_page_start</tt> lambda if one was provided at
0
- # document creation time (See Document.initialize).
0
+ # document creation time (See Document.new).
0
      #
0
      def start_new_page
0
        finish_page_content if @page_content
0
@@ -129,7 +129,7 @@ module Prawn
0
       @pages.data[:Count]
0
     end
0
        
0
- # Renders the PDF document, returning a string by default.
0
+ # Renders the PDF document to string
0
     #
0
     def render
0
       output = StringIO.new
0
@@ -159,37 +159,79 @@ module Prawn
0
       @bounding_box
0
     end
0
 
0
+ # Moves up the document by n points
0
+ #
0
     def move_up(n)
0
       self.y += n
0
     end
0
 
0
+ # Moves down the document by n point
0
+ #
0
     def move_down(n)
0
       self.y -= n
0
     end
0
 
0
+
0
+ # Moves down the document and then executes a block.
0
+ #
0
+ # pdf.text "some text"
0
+ # pdf.pad_top(100) do
0
+ # pdf.text "This is 100 points below the previous line of text"
0
+ # end
0
+ # pdf.text "This text appears right below the previous line of text"
0
+ #
0
     def pad_top(y)
0
       move_down(y)
0
       yield
0
     end
0
 
0
+ # Executes a block then moves down the document
0
+ #
0
+ # pdf.text "some text"
0
+ # pdf.pad_bottom(100) do
0
+ # pdf.text "This text appears right below the previous line of text"
0
+ # end
0
+ # pdf.text "This is 100 points below the previous line of text"
0
+ #
0
     def pad_bottom(y)
0
       yield
0
       move_down(y)
0
     end
0
 
0
+ # Moves down the document by y, executes a block, then moves down the
0
+ # document by y again.
0
+ #
0
+ # pdf.text "some text"
0
+ # pdf.pad(100) do
0
+ # pdf.text "This is 100 points below the previous line of text"
0
+ # end
0
+ # pdf.text "This is 100 points below the previous line of text"
0
+ #
0
     def pad(y)
0
       move_down(y)
0
       yield
0
       move_down(y)
0
     end
0
 
0
+
0
+ # Builds and renders a Document::Table object from raw data.
0
+ # For details on the options that can be passed, see
0
+ # Document::Table.new
0
+ #
0
+ # data = [["Gregory","Brown"],["James","Healy"],["Jia","Wu"]]
0
+ #
0
+ # Prawn::Document.generate("table.pdf") do
0
+ # table data, :headers => ["First Name", "Last Name"]
0
+ # end
0
+ #
0
     def table(data,options={})
0
       Prawn::Document::Table.new(data,self,options).draw
0
     end
0
 
0
- # Stores the current state of the named attributes, executes the block, and
0
- # then restores the original values after the block has executed.
0
- def mask(*fields)
0
+ def mask(*fields) # :nodoc:
0
+ # Stores the current state of the named attributes, executes the block, and
0
+ # then restores the original values after the block has executed.
0
+ # -- I will remove the nodoc if/when this feature is a little less hacky
0
       stored = {}
0
       fields.each { |f| stored[f] = send(f) }
0
       yield

Comments

    No one has commented yet.