lib/mork/sheet_pdf.rb in mork-0.12.0 vs lib/mork/sheet_pdf.rb in mork-0.13.2
- old
+ new
@@ -11,11 +11,11 @@
@content =
case content
when Array; content
when Hash; [content]
when String
- raise IOError, "File '#{content}' not found" unless File.exists? content
+ fail Errno::ENOENT unless File.exists? content
symbolize YAML.load_file(content)
end
@grip =
case layout
when NilClass; GridPDF.new
@@ -74,20 +74,24 @@
questions_and_choices ch_len.first
end
end
repeat(:all) do
- calibration_cells
- fill do
- @grip.reg_marks.each do |r|
- circle r[:p], r[:r]
- end
+ calibration_cell_repeater
+ registration_mark_repeater
+ end
+ end
+
+ def registration_mark_repeater
+ fill do
+ @grip.reg_marks.each do |r|
+ circle r[:p], r[:r]
end
end
end
- def calibration_cells
+ def calibration_cell_repeater
@grip.calibration_cells_xy.each { |c| stamp_at 'X', c }
end
def barcode(code)
# draw the dark calibration bar
@@ -200,10 +204,10 @@
end
end
end
def ch_len
- @all_choice_lengths ||= @content.collect { |c| c[:choices] }
+ @all_choice_lengths ||= @content.map { |c| c[:choices] }
end
# Choices are labeled 'A', 'B', ...
def letter_for(c)
(65+c).chr