Class: DOT::DOTElement

Inherits:
DOTSimpleElement show all
Defined in:
lib/rdoc/dot/dot.rb

Overview

an element that has options ( node, edge or graph )

Direct Known Subclasses

DOTEdge, DOTNode, DOTSubgraph

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DOTSimpleElement

#to_s

Constructor Details

#initialize(params = {}, option_list = []) ⇒ DOTElement

Returns a new instance of DOTElement.



97
98
99
100
101
102
103
104
105
106
# File 'lib/rdoc/dot/dot.rb', line 97

def initialize( params = {}, option_list = [] )
    super( params )
    @name = params['name'] ? params['name'] : nil
    @parent = params['parent'] ? params['parent'] : nil
    @options = {}
    option_list.each{ |i|
        @options[i] = params[i] if params[i]
    }
    @options['label'] ||= @name if @name != 'node'
end

Instance Attribute Details

#nameObject

attr_reader :parent



95
96
97
# File 'lib/rdoc/dot/dot.rb', line 95

def name
  @name
end

#optionsObject

attr_reader :parent



95
96
97
# File 'lib/rdoc/dot/dot.rb', line 95

def options
  @options
end

Instance Method Details

#each_optionObject



108
109
110
# File 'lib/rdoc/dot/dot.rb', line 108

def each_option
    @options.each{ |i| yield i }
end

#each_option_pairObject



112
113
114
# File 'lib/rdoc/dot/dot.rb', line 112

def each_option_pair
    @options.each_pair{ |key, val| yield key, val }
end