prawn 2.0.1 → 2.0.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.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -5
  3. data/lib/prawn.rb +4 -4
  4. data/lib/prawn/document.rb +47 -46
  5. data/lib/prawn/document/bounding_box.rb +13 -19
  6. data/lib/prawn/document/column_box.rb +3 -5
  7. data/lib/prawn/document/internals.rb +0 -1
  8. data/lib/prawn/document/span.rb +12 -12
  9. data/lib/prawn/errors.rb +32 -33
  10. data/lib/prawn/font.rb +29 -36
  11. data/lib/prawn/font/afm.rb +20 -20
  12. data/lib/prawn/font/dfont.rb +0 -1
  13. data/lib/prawn/font/ttf.rb +30 -27
  14. data/lib/prawn/font_metric_cache.rb +4 -8
  15. data/lib/prawn/graphics.rb +37 -42
  16. data/lib/prawn/graphics/cap_style.rb +1 -1
  17. data/lib/prawn/graphics/color.rb +21 -23
  18. data/lib/prawn/graphics/dash.rb +5 -6
  19. data/lib/prawn/graphics/join_style.rb +1 -2
  20. data/lib/prawn/graphics/patterns.rb +25 -21
  21. data/lib/prawn/graphics/transformation.rb +4 -5
  22. data/lib/prawn/graphics/transparency.rb +6 -8
  23. data/lib/prawn/grid.rb +21 -14
  24. data/lib/prawn/image_handler.rb +2 -2
  25. data/lib/prawn/images.rb +29 -31
  26. data/lib/prawn/images/image.rb +1 -1
  27. data/lib/prawn/images/jpg.rb +10 -12
  28. data/lib/prawn/images/png.rb +13 -13
  29. data/lib/prawn/measurements.rb +7 -14
  30. data/lib/prawn/outline.rb +6 -6
  31. data/lib/prawn/repeater.rb +1 -5
  32. data/lib/prawn/security.rb +17 -25
  33. data/lib/prawn/security/arcfour.rb +1 -1
  34. data/lib/prawn/soft_mask.rb +11 -12
  35. data/lib/prawn/stamp.rb +16 -8
  36. data/lib/prawn/text.rb +23 -20
  37. data/lib/prawn/text/box.rb +3 -6
  38. data/lib/prawn/text/formatted/arranger.rb +9 -12
  39. data/lib/prawn/text/formatted/box.rb +23 -22
  40. data/lib/prawn/text/formatted/fragment.rb +0 -4
  41. data/lib/prawn/text/formatted/line_wrap.rb +13 -24
  42. data/lib/prawn/text/formatted/parser.rb +16 -20
  43. data/lib/prawn/text/formatted/wrap.rb +2 -7
  44. data/lib/prawn/utilities.rb +6 -3
  45. data/lib/prawn/version.rb +1 -1
  46. data/manual/basic_concepts/basic_concepts.rb +0 -2
  47. data/manual/basic_concepts/view.rb +1 -1
  48. data/manual/bounding_box/bounding_box.rb +0 -3
  49. data/manual/bounding_box/russian_boxes.rb +7 -8
  50. data/manual/bounding_box/stretchy.rb +0 -1
  51. data/manual/contents.rb +2 -2
  52. data/manual/cover.rb +11 -12
  53. data/manual/document_and_page_options/document_and_page_options.rb +2 -5
  54. data/manual/document_and_page_options/metadata.rb +10 -10
  55. data/manual/document_and_page_options/page_size.rb +0 -1
  56. data/manual/graphics/fill_rules.rb +5 -4
  57. data/manual/graphics/graphics.rb +0 -3
  58. data/manual/graphics/lines_and_curves.rb +1 -1
  59. data/manual/graphics/rotate.rb +0 -2
  60. data/manual/graphics/scale.rb +4 -2
  61. data/manual/graphics/soft_masks.rb +0 -1
  62. data/manual/graphics/stroke_cap.rb +1 -1
  63. data/manual/graphics/stroke_join.rb +1 -1
  64. data/manual/graphics/translate.rb +3 -3
  65. data/manual/graphics/transparency.rb +0 -1
  66. data/manual/how_to_read_this_manual.rb +0 -1
  67. data/manual/images/images.rb +0 -3
  68. data/manual/layout/boxes.rb +5 -5
  69. data/manual/layout/content.rb +2 -2
  70. data/manual/layout/layout.rb +0 -3
  71. data/manual/outline/outline.rb +0 -3
  72. data/manual/repeatable_content/page_numbering.rb +1 -1
  73. data/manual/repeatable_content/repeatable_content.rb +0 -3
  74. data/manual/repeatable_content/repeater.rb +6 -6
  75. data/manual/security/encryption.rb +0 -2
  76. data/manual/security/permissions.rb +0 -2
  77. data/manual/security/security.rb +0 -3
  78. data/manual/text/alignment.rb +3 -3
  79. data/manual/text/color.rb +0 -1
  80. data/manual/text/column_box.rb +0 -1
  81. data/manual/text/fallback_fonts.rb +2 -2
  82. data/manual/text/formatted_callbacks.rb +3 -2
  83. data/manual/text/paragraph_indentation.rb +2 -3
  84. data/manual/text/registering_families.rb +13 -9
  85. data/manual/text/rotation.rb +0 -1
  86. data/manual/text/text.rb +0 -3
  87. data/manual/text/text_box_overflow.rb +7 -5
  88. data/manual/text/utf8.rb +1 -1
  89. data/manual/text/win_ansi_charset.rb +2 -2
  90. data/prawn.gemspec +4 -4
  91. data/spec/acceptance/png.rb +6 -7
  92. data/spec/annotations_spec.rb +21 -28
  93. data/spec/bounding_box_spec.rb +100 -109
  94. data/spec/column_box_spec.rb +26 -32
  95. data/spec/destinations_spec.rb +2 -4
  96. data/spec/document_spec.rb +145 -151
  97. data/spec/extensions/mocha.rb +0 -1
  98. data/spec/font_metric_cache_spec.rb +7 -7
  99. data/spec/font_spec.rb +103 -102
  100. data/spec/formatted_text_arranger_spec.rb +76 -74
  101. data/spec/formatted_text_box_spec.rb +170 -159
  102. data/spec/formatted_text_fragment_spec.rb +57 -56
  103. data/spec/graphics_spec.rb +158 -175
  104. data/spec/grid_spec.rb +28 -29
  105. data/spec/image_handler_spec.rb +4 -5
  106. data/spec/images_spec.rb +50 -36
  107. data/spec/inline_formatted_text_parser_spec.rb +397 -393
  108. data/spec/jpg_spec.rb +4 -6
  109. data/spec/line_wrap_spec.rb +54 -55
  110. data/spec/measurement_units_spec.rb +12 -15
  111. data/spec/outline_spec.rb +77 -98
  112. data/spec/png_spec.rb +55 -65
  113. data/spec/reference_spec.rb +3 -3
  114. data/spec/repeater_spec.rb +20 -26
  115. data/spec/security_spec.rb +42 -49
  116. data/spec/soft_mask_spec.rb +4 -5
  117. data/spec/span_spec.rb +5 -6
  118. data/spec/spec_helper.rb +2 -4
  119. data/spec/stamp_spec.rb +41 -22
  120. data/spec/stroke_styles_spec.rb +36 -39
  121. data/spec/text_at_spec.rb +28 -29
  122. data/spec/text_box_spec.rb +160 -165
  123. data/spec/text_rendering_mode_spec.rb +9 -9
  124. data/spec/text_spacing_spec.rb +13 -13
  125. data/spec/text_spec.rb +116 -124
  126. data/spec/text_with_inline_formatting_spec.rb +5 -5
  127. data/spec/transparency_spec.rb +20 -20
  128. data/spec/view_spec.rb +0 -1
  129. metadata +7 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b75f193e883ce03850e0850a8085380b11418d4f
4
- data.tar.gz: 7ebda9fc8a346132f6cb3a56c5b55bd1894af9c8
3
+ metadata.gz: b05cc94288d323f650bc4a44529992282d42b69f
4
+ data.tar.gz: 71cb2515eb6667207083899502a96487807f8667
5
5
  SHA512:
6
- metadata.gz: 9ad5b0b7ec71ec616f1bd77ac06b8a74188b1a1bddd8849255235e31be7bfd447720a1b48da2fef71a727771d6820c028a32f1f1b3b9f58c4e8ac58ff4772e52
7
- data.tar.gz: f0a2d18ef07e0103c55274004b0f11c2f2029af8280ba77f5eb07bdbee2627aa053d6b5bf20a6958e79c86b780299b4da485be4b795571813823b7dc99d0b900
6
+ metadata.gz: 4081995850066454b2ec29d3532ea5470812d8af92606a7e2d65d9514105242d3e4061927559e8280c180732c8223d11f37debc7423382ffeada0820dbfc8c8c
7
+ data.tar.gz: f1ef9c7346cddd535db2acde3a3522bdc4a128dcd8da2eb45439278203ca982e22543de1667a0d7f6435824884f73eb8ed046f6dbf128fa9ad3d721792bc4add
data/Rakefile CHANGED
@@ -17,8 +17,12 @@ end
17
17
  desc "Show library's code statistics"
18
18
  task :stats do
19
19
  require 'code_statistics/code_statistics'
20
- puts CodeStatistics::CodeStatistics.new( [["Prawn", "lib"],
21
- ["Specs", "spec"]] ).to_s
20
+ puts CodeStatistics::CodeStatistics.new(
21
+ [
22
+ ["Prawn", "lib"],
23
+ ["Specs", "spec"]
24
+ ]
25
+ ).to_s
22
26
  end
23
27
 
24
28
  YARD::Rake::YardocTask.new do |t|
@@ -26,12 +30,10 @@ YARD::Rake::YardocTask.new do |t|
26
30
  end
27
31
  task :docs => :yard
28
32
 
29
-
30
33
  desc "Generate the 'Prawn by Example' manual"
31
34
  task :manual do
32
35
  puts "Building manual..."
33
- require File.expand_path(File.join(File.dirname(__FILE__),
34
- %w[manual contents]))
36
+ require File.expand_path(File.join(File.dirname(__FILE__), %w[manual contents]))
35
37
  puts "The Prawn manual is available at manual.pdf. Happy Prawning!"
36
38
  end
37
39
 
@@ -36,10 +36,10 @@ module Prawn
36
36
 
37
37
  def verify_options(accepted, actual) # @private
38
38
  return unless debug || $DEBUG
39
- unless (act=Set[*actual.keys]).subset?(acc=Set[*accepted])
40
- raise Prawn::Errors::UnknownOption,
41
- "\nDetected unknown option(s): #{(act - acc).to_a.inspect}\n" <<
42
- "Accepted options are: #{accepted.inspect}"
39
+ unless (act = Set[*actual.keys]).subset?(acc = Set[*accepted])
40
+ fail Prawn::Errors::UnknownOption,
41
+ "\nDetected unknown option(s): #{(act - acc).to_a.inspect}\n" \
42
+ "Accepted options are: #{accepted.inspect}"
43
43
  end
44
44
  yield if block_given?
45
45
  end
@@ -14,7 +14,6 @@ require_relative "document/internals"
14
14
  require_relative "document/span"
15
15
 
16
16
  module Prawn
17
-
18
17
  # The Prawn::Document class is how you start creating a PDF document.
19
18
  #
20
19
  # There are three basic ways you can instantiate PDF Documents in Prawn, they
@@ -102,7 +101,7 @@ module Prawn
102
101
  # @group Stable Attributes
103
102
 
104
103
  attr_accessor :margin_box
105
- attr_reader :margins, :y
104
+ attr_reader :margins, :y
106
105
  attr_accessor :page_number
107
106
 
108
107
  # @group Extension Attributes
@@ -138,8 +137,8 @@ module Prawn
138
137
  # pdf.draw_text content, :at => [200,720], :size => 32
139
138
  # end
140
139
  #
141
- def self.generate(filename,options={},&block)
142
- pdf = new(options,&block)
140
+ def self.generate(filename, options = {}, &block)
141
+ pdf = new(options, &block)
143
142
  pdf.render_file(filename)
144
143
  end
145
144
 
@@ -189,7 +188,7 @@ module Prawn
189
188
  # # New document, with background
190
189
  # pdf = Prawn::Document.new(:background => "#{Prawn::DATADIR}/images/pigs.jpg")
191
190
  #
192
- def initialize(options={},&block)
191
+ def initialize(options = {}, &block)
193
192
  options = options.dup
194
193
 
195
194
  Prawn.verify_options VALID_OPTIONS, options
@@ -198,8 +197,8 @@ module Prawn
198
197
  # raise NotImplementedError if options[:skip_page_creation]
199
198
 
200
199
  self.class.extensions.reverse_each { |e| extend e }
201
- @internal_state = PDF::Core::DocumentState.new(options)
202
- @internal_state.populate_pages_from_store(self)
200
+ self.state = PDF::Core::DocumentState.new(options)
201
+ self.state.populate_pages_from_store(self)
203
202
  renderer.min_version(state.store.min_version) if state.store.min_version
204
203
 
205
204
  renderer.min_version(1.6) if options[:print_scaling] == :none
@@ -246,13 +245,17 @@ module Prawn
246
245
  last_page_margins = last_page.margins.dup
247
246
  end
248
247
 
249
- page_options = {:size => options[:size] || last_page_size,
250
- :layout => options[:layout] || last_page_layout,
251
- :margins => last_page_margins}
248
+ page_options = {
249
+ :size => options[:size] || last_page_size,
250
+ :layout => options[:layout] || last_page_layout,
251
+ :margins => last_page_margins
252
+ }
252
253
  if last_page
253
254
  new_graphic_state = last_page.graphic_state.dup if last_page.graphic_state
254
- #erase the color space so that it gets reset on new page for fussy pdf-readers
255
+
256
+ # erase the color space so that it gets reset on new page for fussy pdf-readers
255
257
  new_graphic_state.color_space = {} if new_graphic_state
258
+
256
259
  page_options.merge!(:graphic_state => new_graphic_state)
257
260
  end
258
261
 
@@ -300,7 +303,7 @@ module Prawn
300
303
  #
301
304
  def go_to_page(k)
302
305
  @page_number = k
303
- state.page = state.pages[k-1]
306
+ state.page = state.pages[k - 1]
304
307
  generate_margin_box
305
308
  @y = @bounding_box.absolute_top
306
309
  end
@@ -466,7 +469,6 @@ module Prawn
466
469
  move_down(y)
467
470
  end
468
471
 
469
-
470
472
  # Indents the specified number of PDF points for the duration of the block
471
473
  #
472
474
  # pdf.text "some text"
@@ -518,18 +520,20 @@ module Prawn
518
520
  # :size => 14}
519
521
  # end
520
522
  #
521
- def number_pages(string, options={})
523
+ def number_pages(string, options = {})
522
524
  opts = options.dup
523
525
  start_count_at = opts.delete(:start_count_at).to_i
524
- page_filter = if opts.has_key?(:page_filter)
525
- opts.delete(:page_filter)
526
+
527
+ if opts.key?(:page_filter)
528
+ page_filter = opts.delete(:page_filter)
526
529
  else
527
- :all
530
+ page_filter = :all
528
531
  end
532
+
529
533
  total_pages = opts.delete(:total_pages)
530
534
  txtcolor = opts.delete(:color)
531
535
  # An explicit height so that we can draw page numbers in the margins
532
- opts[:height] = 50 unless opts.has_key?(:height)
536
+ opts[:height] = 50 unless opts.key?(:height)
533
537
 
534
538
  start_count = false
535
539
  pseudopage = 0
@@ -547,7 +551,7 @@ module Prawn
547
551
  # have to use fill_color here otherwise text reverts back to default fill color
548
552
  fill_color txtcolor unless txtcolor.nil?
549
553
  total_pages = total_pages.nil? ? page_count : total_pages
550
- str = string.gsub("<page>","#{pseudopage}").gsub("<total>","#{total_pages}")
554
+ str = string.gsub("<page>", "#{pseudopage}").gsub("<total>", "#{total_pages}")
551
555
  text_box str, opts
552
556
  start_count = true # increment page count as soon as first match found
553
557
  end
@@ -568,20 +572,20 @@ module Prawn
568
572
  #
569
573
  # @private
570
574
  def group(*a, &b)
571
- raise NotImplementedError,
572
- "Document#group has been disabled because its implementation "+
573
- "lead to corrupted documents whenever a page boundary was "+
574
- "crossed. We will try to work on reimplementing it in a "+
575
- "future release"
575
+ fail NotImplementedError,
576
+ "Document#group has been disabled because its implementation " \
577
+ "lead to corrupted documents whenever a page boundary was " \
578
+ "crossed. We will try to work on reimplementing it in a " \
579
+ "future release"
576
580
  end
577
581
 
578
582
  # @private
579
583
  def transaction
580
- raise NotImplementedError,
581
- "Document#transaction has been disabled because its implementation "+
582
- "lead to corrupted documents whenever a page boundary was "+
583
- "crossed. We will try to work on reimplementing it in a "+
584
- "future release"
584
+ fail NotImplementedError,
585
+ "Document#transaction has been disabled because its implementation " \
586
+ "lead to corrupted documents whenever a page boundary was " \
587
+ "crossed. We will try to work on reimplementing it in a " \
588
+ "future release"
585
589
  end
586
590
 
587
591
  # Provides a way to execute a block of code repeatedly based on a
@@ -599,9 +603,9 @@ module Prawn
599
603
  when :all
600
604
  true
601
605
  when :odd
602
- page_number % 2 == 1
606
+ page_number.odd?
603
607
  when :even
604
- page_number % 2 == 0
608
+ page_number.even?
605
609
  when Range, Array
606
610
  page_filter.include?(page_number)
607
611
  when Proc
@@ -612,9 +616,9 @@ module Prawn
612
616
  # @private
613
617
 
614
618
  def mask(*fields)
615
- # Stores the current state of the named attributes, executes the block, and
616
- # then restores the original values after the block has executed.
617
- # -- I will remove the nodoc if/when this feature is a little less hacky
619
+ # Stores the current state of the named attributes, executes the block, and
620
+ # then restores the original values after the block has executed.
621
+ # -- I will remove the nodoc if/when this feature is a little less hacky
618
622
  stored = {}
619
623
  fields.each { |f| stored[f] = send(f) }
620
624
  yield
@@ -634,9 +638,7 @@ module Prawn
634
638
  ## Internals. Don't depend on them!
635
639
 
636
640
  # @private
637
- def state
638
- @internal_state
639
- end
641
+ attr_accessor :state
640
642
 
641
643
  # @private
642
644
  def page
@@ -645,7 +647,6 @@ module Prawn
645
647
 
646
648
  private
647
649
 
648
-
649
650
  # setting override_settings to true ensures that a new graphic state does not end up using
650
651
  # previous settings.
651
652
  def use_graphic_settings(override_settings = false)
@@ -684,23 +685,23 @@ module Prawn
684
685
  if options[:margin]
685
686
  # Treat :margin as CSS shorthand with 1-4 values.
686
687
  margin = Array(options[:margin])
687
- positions = { 4 => [0,1,2,3], 3 => [0,1,2,1],
688
- 2 => [0,1,0,1], 1 => [0,0,0,0] }[margin.length]
688
+ positions = { 4 => [0, 1, 2, 3], 3 => [0, 1, 2, 1],
689
+ 2 => [0, 1, 0, 1], 1 => [0, 0, 0, 0] }[margin.length]
689
690
 
690
- [:top, :right, :bottom, :left].zip(positions).each do |p,i|
691
+ [:top, :right, :bottom, :left].zip(positions).each do |p, i|
691
692
  options[:"#{p}_margin"] ||= margin[i]
692
693
  end
693
694
  end
694
695
 
695
- [:left,:right,:top,:bottom].each do |side|
696
- if margin = options[:"#{side}_margin"]
697
- state.page.margins[side] = margin
698
- end
696
+ [:left, :right, :top, :bottom].each do |side|
697
+ if margin = options[:"#{side}_margin"]
698
+ state.page.margins[side] = margin
699
+ end
699
700
  end
700
701
  end
701
702
 
702
703
  def font_metric_cache #:nodoc:
703
- @font_metric_cache ||= FontMetricCache.new( self )
704
+ @font_metric_cache ||= FontMetricCache.new(self)
704
705
  end
705
706
  end
706
707
  end
@@ -172,7 +172,8 @@ module Prawn
172
172
  def canvas(&block)
173
173
  init_bounding_box(block, :hold_position => true) do |_|
174
174
  # Canvas bbox acts like margin_box in that its parent bounds are unset.
175
- @bounding_box = BoundingBox.new(self, nil, [0,page.dimensions[3]],
175
+ @bounding_box = BoundingBox.new(
176
+ self, nil, [0, page.dimensions[3]],
176
177
  :width => page.dimensions[2],
177
178
  :height => page.dimensions[3]
178
179
  )
@@ -181,10 +182,10 @@ module Prawn
181
182
 
182
183
  private
183
184
 
184
- def init_bounding_box(user_block, options={}, &init_block)
185
+ def init_bounding_box(user_block, options = {}, &init_block)
185
186
  unless user_block
186
- raise ArgumentError,
187
- "bounding boxes require a block to be drawn within the box"
187
+ fail ArgumentError,
188
+ "bounding boxes require a block to be drawn within the box"
188
189
  end
189
190
 
190
191
  parent_box = @bounding_box
@@ -219,10 +220,9 @@ module Prawn
219
220
  # is used for.
220
221
  #
221
222
  class BoundingBox
222
-
223
- def initialize(document, parent, point, options={}) # @private
223
+ def initialize(document, parent, point, options = {}) # @private
224
224
  unless options[:width]
225
- raise ArgumentError, "BoundingBox needs the :width option to be set"
225
+ fail ArgumentError, "BoundingBox needs the :width option to be set"
226
226
  end
227
227
 
228
228
  @document = document
@@ -264,7 +264,6 @@ module Prawn
264
264
  0
265
265
  end
266
266
 
267
-
268
267
  # Temporarily adjust the @x coordinate to allow for left_padding
269
268
  #
270
269
  # Example:
@@ -360,7 +359,7 @@ module Prawn
360
359
  # end
361
360
  #
362
361
  def top_left
363
- [left,top]
362
+ [left, top]
364
363
  end
365
364
 
366
365
  # Relative top-right point of the bounding box
@@ -373,7 +372,7 @@ module Prawn
373
372
  # end
374
373
  #
375
374
  def top_right
376
- [right,top]
375
+ [right, top]
377
376
  end
378
377
 
379
378
  # Relative bottom-right point of the bounding box
@@ -385,7 +384,7 @@ module Prawn
385
384
  # end
386
385
  #
387
386
  def bottom_right
388
- [right,bottom]
387
+ [right, bottom]
389
388
  end
390
389
 
391
390
  # Relative bottom-left point of the bounding box
@@ -397,7 +396,7 @@ module Prawn
397
396
  # end
398
397
  #
399
398
  def bottom_left
400
- [left,bottom]
399
+ [left, bottom]
401
400
  end
402
401
 
403
402
  # Absolute left x-coordinate of the bounding box
@@ -449,10 +448,7 @@ module Prawn
449
448
  end
450
449
 
451
450
  # Width of the bounding box
452
- #
453
- def width
454
- @width
455
- end
451
+ attr_reader :width
456
452
 
457
453
  # Height of the bounding box. If the box is 'stretchy' (unspecified
458
454
  # height attribute), height is calculated as the distance from the top of
@@ -500,7 +496,7 @@ module Prawn
500
496
  #
501
497
  def reference_bounds
502
498
  if stretchy?
503
- raise "Can't find reference bounds: my parent is unset" unless @parent
499
+ fail "Can't find reference bounds: my parent is unset" unless @parent
504
500
  @parent.reference_bounds
505
501
  else
506
502
  self
@@ -532,8 +528,6 @@ module Prawn
532
528
  bounds.instance_variable_set("@document", document)
533
529
  bounds
534
530
  end
535
-
536
531
  end
537
-
538
532
  end
539
533
  end
@@ -10,7 +10,6 @@ require_relative "bounding_box"
10
10
 
11
11
  module Prawn
12
12
  class Document
13
-
14
13
  # @group Experimental API
15
14
 
16
15
  # A column box is a bounding box with the additional property that when
@@ -37,7 +36,7 @@ module Prawn
37
36
 
38
37
  private
39
38
 
40
- def init_column_box(user_block, options={}, &init_block)
39
+ def init_column_box(user_block, options = {}, &init_block)
41
40
  parent_box = @bounding_box
42
41
 
43
42
  init_block.call(parent_box)
@@ -53,11 +52,10 @@ module Prawn
53
52
  # work.
54
53
  #
55
54
  class ColumnBox < BoundingBox
56
-
57
- def initialize(document, parent, point, options={}) #:nodoc:
55
+ def initialize(document, parent, point, options = {}) #:nodoc:
58
56
  super
59
57
  @columns = options[:columns] || 3
60
- @spacer = options[:spacer] || @document.font_size
58
+ @spacer = options[:spacer] || @document.font_size
61
59
  @current_column = 0
62
60
  @reflow_margins = options[:reflow_margins]
63
61
  end
@@ -10,7 +10,6 @@ require "forwardable"
10
10
 
11
11
  module Prawn
12
12
  class Document
13
-
14
13
  # This module exposes a few low-level PDF features for those who want
15
14
  # to extend Prawn's core functionality. If you are not comfortable with
16
15
  # low level PDF functionality as defined by Adobe's specification, chances
@@ -26,23 +26,23 @@ module Prawn
26
26
  # text "Here's some centered text in a 350 point column. " * 100
27
27
  # end
28
28
  #
29
- def span(width, options={})
29
+ def span(width, options = {})
30
30
  Prawn.verify_options [:position], options
31
31
  original_position = self.y
32
32
 
33
33
  # FIXME: Any way to move this upstream?
34
34
  left_boundary = case(options[:position] || :left)
35
- when :left
36
- margin_box.absolute_left
37
- when :center
38
- margin_box.absolute_left + margin_box.width / 2.0 - width / 2.0
39
- when :right
40
- margin_box.absolute_right - width
41
- when Numeric
42
- margin_box.absolute_left + options[:position]
43
- else
44
- raise ArgumentError, "Invalid option for :position"
45
- end
35
+ when :left
36
+ margin_box.absolute_left
37
+ when :center
38
+ margin_box.absolute_left + margin_box.width / 2.0 - width / 2.0
39
+ when :right
40
+ margin_box.absolute_right - width
41
+ when Numeric
42
+ margin_box.absolute_left + options[:position]
43
+ else
44
+ fail ArgumentError, "Invalid option for :position"
45
+ end
46
46
 
47
47
  # we need to bust out of whatever nested bounding boxes we're in.
48
48
  canvas do