class Draught::Renderer
Attributes
root_box[R]
Public Class Methods
new(root_box)
click to toggle source
# File lib/draught/renderer.rb, line 60 def initialize(root_box) @root_box = root_box end
render_to_file(sheet, path)
click to toggle source
# File lib/draught/renderer.rb, line 54 def self.render_to_file(sheet, path) new(sheet).render_to_file(path) end
Public Instance Methods
context()
click to toggle source
# File lib/draught/renderer.rb, line 64 def context @context ||= PdfContext.new(root_box.width, root_box.height) end
render()
click to toggle source
# File lib/draught/renderer.rb, line 72 def render walk(root_box) end
render_container(container, context)
click to toggle source
# File lib/draught/renderer.rb, line 76 def render_container(container, context) end
render_path(path, context)
click to toggle source
# File lib/draught/renderer.rb, line 79 def render_path(path, context) context.draw_closed_path(path) end
render_to_file(path)
click to toggle source
# File lib/draught/renderer.rb, line 68 def render_to_file(path) render && context.save_as(path) end
Private Instance Methods
walk(box)
click to toggle source
# File lib/draught/renderer.rb, line 85 def walk(box) render_container(box, context) if box.box_type.include?(:container) box.paths.each do |child| render_path(child, context) if child.box_type.include?(:path) walk(child) end end