The base class for all drawable elements.
Create a new Element. type specifies the type of the element. attrs is a list of the supported attributes. values is a hash of the provided attributes.
# File lib/taskjuggler/Painter/Element.rb, line 28 def initialize(type, attrs, values) @type = type @attributes = attrs @values = {} @text = nil values.each do |k, v| unless @attributes.include?(k) raise ArgumentError, "Unsupported attribute #{k}" end @values[k] = v end end
Convert the Element into an XMLElement tree using SVG syntax.
# File lib/taskjuggler/Painter/Element.rb, line 43 def to_svg el = XMLElement.new(@type, valuesToSVG) el << XMLText.new(@text) if @text el end