File: boxes.rb

package info (click to toggle)
ruby-prawn 1.0.0~rc1%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,248 kB
  • sloc: ruby: 17,499; sh: 44; makefile: 17
file content (27 lines) | stat: -rw-r--r-- 977 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# encoding: utf-8
#
# After defined the grid is there but nothing happens. To start taking effect
# we need to use the grid boxes.
#
# <code>grid</code> has three different return values based on the arguments
# received. With no arguments it will return the grid itself. With integers it
# will return the grid box at those indices. With two arrays it will return a
# multi-box spanning the region of the two grid boxes at the arrays indices.
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::Example.generate(filename) do
  # The grid only need to be defined once, but since all the examples should be
  # able to run alone we are repeating it on every example
  define_grid(:columns => 5, :rows => 8, :gutter => 10)
  
  grid(4,0).show
  grid(5,1).show
  
  grid([6,2], [7,3]).show
  
  grid([4,4], [7,4]).show
  grid([7,0], [7,1]).show
end