Parent

GraphViz::Attrs

Attributes

data[RW]

Public Class Methods

new( gviz, name, attributs ) click to toggle source
# File lib/graphviz/attrs.rb, line 26
def initialize( gviz, name, attributs )
  @name      = name
  @attributs = attributs
  @data      = Hash::new( )
        @graphviz  = gviz
end

Public Instance Methods

[]( xKey ) click to toggle source
# File lib/graphviz/attrs.rb, line 43
def []( xKey )
  if xKey.class == Hash
    xKey.each do |k, v|
      self[k] = v
    end
  else
    if @data.key?( xKey.to_s ) == false
      nil
    end
    @data[xKey.to_s]
  end
end
[]=( xKey, xValue ) click to toggle source
# File lib/graphviz/attrs.rb, line 56
def []=( xKey, xValue )
  unless @attributs.keys.include?( xKey.to_s )
    raise ArgumentError, "#{@name} attribut '#{xKey.to_s}' invalid"
  end
  
  @data[xKey.to_s] = GraphViz::Types.const_get(@attributs[xKey.to_s]).new( xValue )

  if @graphviz.nil? == false
    @graphviz.set_position( @name, xKey.to_s, @data[xKey.to_s] )
  end
end
each() click to toggle source
# File lib/graphviz/attrs.rb, line 33
def each
  @data.each do |k, v|
    yield(k, v)
  end
end
to_h() click to toggle source
# File lib/graphviz/attrs.rb, line 39
def to_h
  @data.clone
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.