Class: Sketch::Element
- Inherits:
-
Valuable
- Object
- Valuable
- Sketch::Element
show all
- Includes:
- Base
- Defined in:
- lib/sketch/element.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Base
#svg_attributes
Class Method Details
.central_point(x_param = :x, y_param = :y) ⇒ Object
18
19
20
21
22
23
24
25
26
|
# 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
|
Instance Method Details
#draw(canvas) ⇒ Object
9
10
11
|
# File 'lib/sketch/element.rb', line 9
def draw(canvas)
canvas.send( self.svg_node, svg_attributes )
end
|
#svg_node ⇒ Object
13
14
15
|
# File 'lib/sketch/element.rb', line 13
def svg_node
self.class.name.split('::').last.downcase
end
|