class VisualizeRuby::Edge
Attributes
color[RW]
dir[R]
display[RW]
label[R]
nodes[R]
style[R]
type[R]
Public Class Methods
new(name: nil, nodes:, dir: :forward, type: :default, display: :visual, **opts)
click to toggle source
# File lib/visualize_ruby/edge.rb, line 16 def initialize(name: nil, nodes:, dir: :forward, type: :default, display: :visual, **opts) @label = name.to_s if name @nodes = nodes @dir = dir @style = style @color = color @type = type @display = display post_initialize(opts) end
Public Instance Methods
==(other)
click to toggle source
# File lib/visualize_ruby/edge.rb, line 57 def ==(other) other.class == self.class && other.hash == self.hash end
Also aliased as: eql?
direction_symbol()
click to toggle source
# File lib/visualize_ruby/edge.rb, line 44 def direction_symbol case dir when :forward "->" when :none "-" end end
hash()
click to toggle source
# File lib/visualize_ruby/edge.rb, line 63 def hash [dir, name, nodes.map(&:hash), style, color].hash end
inspect()
click to toggle source
# File lib/visualize_ruby/edge.rb, line 53 def inspect "#<VisualizeRuby::Edge #{to_a.join(" ")}>" end
Also aliased as: to_s
node_a()
click to toggle source
# File lib/visualize_ruby/edge.rb, line 27 def node_a nodes[0] end
node_b()
click to toggle source
# File lib/visualize_ruby/edge.rb, line 31 def node_b nodes[1] end
to_a()
click to toggle source
# File lib/visualize_ruby/edge.rb, line 35 def to_a [ node_a.name.to_s, label, direction_symbol, node_b.name.to_s, ].compact end