class RGL::DOT::Edge
This is an undirected edge representation.
Attributes
A node or subgraph reference or instance to be used as the starting point for an edge.
A node or subgraph reference or instance to be used as the ending point for an edge.
Public Class Methods
Source
# File lib/rgl/rdot.rb 481 def initialize(params = {}, option_list = EDGE_OPTS+EDGE_OPTS_LGCY) 482 super(params, option_list) 483 @from = params['from'] ? params['from'] : nil 484 @to = params['to'] ? params['to'] : nil 485 end
Creates a new Edge
with the params Hash providing settings for all edge options. The option_list parameter restricts those options to the list of valid names it contains.
Calls superclass method
RGL::DOT::Element::new
Public Instance Methods
Source
# File lib/rgl/rdot.rb 492 def to_s(leader = '', indent = ' ') 493 stringified_options = @options.collect do |name, val| 494 unless val.nil? 495 leader + indent + "#{quote_ID(name)} = #{quote_ID(val)}" 496 end 497 end.compact.join(",\n") 498 499 f_s = @from || '' 500 t_s = @to || '' 501 502 if stringified_options.empty? 503 leader + quote_ID(f_s) + ' ' + edge_link + ' ' + quote_ID(t_s) 504 else 505 leader + quote_ID(f_s) + ' ' + edge_link + ' ' + quote_ID(t_s) + " [\n" + 506 stringified_options + "\n" + 507 leader + "]" 508 end 509 end
Returns a string representation of this edge which is consumable by the graphviz tools dot
and neato
. The leader parameter is used to indent every line of the returned string, and the indent parameter is used to additionally indent nested items.