class Sketch::Canvas
Public Instance Methods
builder() { |svg| ... }
click to toggle source
# File lib/sketch/canvas.rb, line 17 def builder Nokogiri::XML::Builder.new do |document| render_doctype( document ) document.svg( svg_attributes ) {|svg| yield svg if block_given?} end end
default_doctype()
click to toggle source
# File lib/sketch/canvas.rb, line 24 def default_doctype ['svg', "-//W3C//DTD SVG 1.0//EN", "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"] end
namespace_bindings()
click to toggle source
# File lib/sketch/canvas.rb, line 9 def namespace_bindings { 'xmlns' => 'http://www.w3.org/2000/svg', 'xmlns:ev' => 'http://www.w3.org/2001/xml-events', 'xmlns:xlink' => 'http://www.w3.org/1999/xlink' } end
render_doctype( document )
click to toggle source
# File lib/sketch/canvas.rb, line 28 def render_doctype( document ) self.doctype &&= self.default_doctype if( self.doctype ) document.doc.create_internal_subset(*self.doctype) end end
svg_attributes()
click to toggle source
Calls superclass method
Sketch::Base#svg_attributes
# File lib/sketch/canvas.rb, line 36 def svg_attributes atts = super atts.delete('doctype') atts.merge(namespace_bindings) end