class Sketch::Element

Public Class Methods

central_point( x_param = :x, y_param = :y ) click to toggle source
# File lib/sketch/element.rb, line 18
def central_point( x_param = :x, y_param = :y )
  define_method :point= do |coordinates|
    attributes[x_param], attributes[y_param] = *coordinates
  end
  
  define_method :point do
    [attributes[x_param], attributes[y_param]]
  end
end

Public Instance Methods

draw(canvas) click to toggle source
# File lib/sketch/element.rb, line 9
def draw(canvas)
  canvas.send( self.svg_node, svg_attributes )
end
svg_node() click to toggle source
# File lib/sketch/element.rb, line 13
def svg_node
  self.class.name.split('::').last.downcase
end