class Sketch

Constants

Rectangle

Public Instance Methods

draw(canvas) click to toggle source
# File lib/sketch.rb, line 11
def draw(canvas)
  raise NotImplementedError
end
svg_attributes() click to toggle source
# File lib/sketch.rb, line 27
def svg_attributes
  out = {}
  out[:height]  = self.height if self.height
  out[:width]   = self.width if self.width
  out[:doctype] = self.doctype if self.doctype
  out
end
svg_builder() { |canvas| ... } click to toggle source
# File lib/sketch.rb, line 35
def svg_builder
  Canvas.new( svg_attributes ).builder {|canvas| yield canvas}
end
to_html() click to toggle source
# File lib/sketch.rb, line 21
def to_html
  svg_builder do |canvas|
    self.draw( canvas )
  end.doc.root.to_s
end
to_svg( ) click to toggle source
# File lib/sketch.rb, line 15
def to_svg( )
  svg_builder do |canvas|
    self.draw( canvas )
  end.to_xml
end