Class: DOT::DOTEdge

Inherits:
DOTElement show all
Defined in:
lib/puppet/external/dot.rb

Overview

This is an edge.

Direct Known Subclasses

DOTDirectedEdge

Instance Attribute Summary collapse

Attributes inherited from DOTElement

#name, #options

Attributes inherited from DOTSimpleElement

#name

Instance Method Summary collapse

Methods inherited from DOTElement

#each_option, #each_option_pair

Constructor Details

#initialize(params = {}, option_list = EDGE_OPTS) ⇒ DOTEdge

Returns a new instance of DOTEdge.



297
298
299
300
301
# File 'lib/puppet/external/dot.rb', line 297

def initialize(params = {}, option_list = EDGE_OPTS)
  super(params, option_list)
  @from = params['from'] ? params['from'] : nil
  @to   = params['to'] ? params['to'] : nil
end

Instance Attribute Details

#fromObject

Returns the value of attribute from.



295
296
297
# File 'lib/puppet/external/dot.rb', line 295

def from
  @from
end

#toObject

Returns the value of attribute to.



295
296
297
# File 'lib/puppet/external/dot.rb', line 295

def to
  @to
end

Instance Method Details



303
304
305
# File 'lib/puppet/external/dot.rb', line 303

def edge_link
  '--'
end

#to_s(t = '') ⇒ Object



307
308
309
310
311
312
313
314
# File 'lib/puppet/external/dot.rb', line 307

def to_s(t = '')
  t + "#{@from} #{edge_link} #{to} [\n" +
    @options.to_a.collect{ |i|
      i[1] && i[0] != 'label' ?
        t + $tab + "#{i[0]} = #{i[1]}" :
        i[1] ? t + $tab + "#{i[0]} = \"#{i[1]}\"" : nil
    }.compact.join( "\n" ) + "\n#{t}]\n"
end