Class TaskJuggler::Painter::Element
In: lib/taskjuggler/Painter/Element.rb
Parent: Object

The base class for all drawable elements.

Methods

new   to_svg  

Included Modules

SVGSupport Primitives

Public Class methods

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.

[Source]

# File lib/taskjuggler/Painter/Element.rb, line 30
      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

Public Instance methods

Convert the Element into an XMLElement tree using SVG syntax.

[Source]

# File lib/taskjuggler/Painter/Element.rb, line 45
      def to_svg
        el = XMLElement.new(@type, valuesToSVG)
        el << XMLText.new(@text) if @text
        el
      end

[Validate]