### Home Classes Methods

### In Files

- lib/graphviz/attrs.rb

### Parent

Object

### Methods

- ::new
- #[]
- #[]=
- #each
- #to_h

### Files

- AUTHORS
- COPYING
- README.rdoc

### Class/Module Index

Quicksearch

- GraphViz
- GraphViz::Attrs
- GraphViz::Edge
- GraphViz::Elements
- GraphViz::Ext
- GraphViz::FamilyTree
- GraphViz::FamilyTree::Couple
- GraphViz::FamilyTree::Generation
- GraphViz::FamilyTree::Person
- GraphViz::FamilyTree::Sibling
- GraphViz::GraphML
- GraphViz::Math
- GraphViz::Math::CoordinateError
- GraphViz::Math::Matrix
- GraphViz::Math::ValueError
- GraphViz::Node
- GraphViz::Theory
- GraphViz::Types
- GraphViz::Types::Common
- GraphViz::Types::EscString
- GraphViz::Types::GvDouble
- GraphViz::Types::HtmlString
- GraphViz::Types::LblString
- GraphViz::XML
- Constants
- GVUtils
- Hash
- Object
- String

No matching classes.

# 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.