Class: GraphViz::Elements
Instance Method Summary collapse
- #[](index, type = nil) ⇒ Object
- #each(&b) ⇒ Object
- 
  
    
      #initialize  ⇒ Elements 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Elements. 
- #push(obj) ⇒ Object
- #size_of(type) ⇒ Object
Constructor Details
Instance Method Details
#[](index, type = nil) ⇒ Object
| 31 32 33 34 35 36 37 | # File 'lib/graphviz/elements.rb', line 31 def []( index, type = nil ) if type.nil? return @elements[index] else return @elements_hash_by_type[type][index] end end | 
#each(&b) ⇒ Object
| 17 18 19 20 21 | # File 'lib/graphviz/elements.rb', line 17 def each( &b ) @elements.each do |e| yield( e ) end end | 
#push(obj) ⇒ Object
| 8 9 10 11 12 13 14 15 | # File 'lib/graphviz/elements.rb', line 8 def push( obj ) @elements.push( obj ) if @elements_hash_by_type[obj['type']].nil? @elements_hash_by_type[obj['type']] = Array.new end @elements_hash_by_type[obj['type']].push( obj ) end | 
#size_of(type) ⇒ Object
| 23 24 25 26 27 28 29 | # File 'lib/graphviz/elements.rb', line 23 def size_of( type ) if @elements_hash_by_type[type].nil? return 0 else return @elements_hash_by_type[type].size end end |