Class: Gviz::Edge
Instance Attribute Summary collapse
-
#attrs ⇒ Object
Returns the value of attribute attrs.
-
#ed ⇒ Object
readonly
Returns the value of attribute ed.
-
#ed_port ⇒ Object
readonly
Returns the value of attribute ed_port.
-
#id ⇒ Object
Returns the value of attribute id.
-
#seq ⇒ Object
readonly
Returns the value of attribute seq.
-
#st ⇒ Object
readonly
Returns the value of attribute st.
-
#st_port ⇒ Object
readonly
Returns the value of attribute st_port.
Instance Method Summary collapse
-
#initialize(id, attrs = {}) ⇒ Edge
constructor
A new instance of Edge.
- #nodes ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id, attrs = {}) ⇒ Edge
Returns a new instance of Edge.
3 4 5 6 7 |
# File 'lib/gviz/edge.rb', line 3 def initialize(id, attrs={}) raise ArgumentError, "edge `attrs` must a hash" unless attrs.is_a?(Hash) id, @st, @ed, @seq, @st_port, @ed_port = parse_id(id) super(id, attrs) end |
Instance Attribute Details
#attrs ⇒ Object
Returns the value of attribute attrs
1 2 3 |
# File 'lib/gviz/edge.rb', line 1 def attrs @attrs end |
#ed ⇒ Object (readonly)
Returns the value of attribute ed.
2 3 4 |
# File 'lib/gviz/edge.rb', line 2 def ed @ed end |
#ed_port ⇒ Object (readonly)
Returns the value of attribute ed_port.
2 3 4 |
# File 'lib/gviz/edge.rb', line 2 def ed_port @ed_port end |
#id ⇒ Object
Returns the value of attribute id
1 2 3 |
# File 'lib/gviz/edge.rb', line 1 def id @id end |
#seq ⇒ Object (readonly)
Returns the value of attribute seq.
2 3 4 |
# File 'lib/gviz/edge.rb', line 2 def seq @seq end |
#st ⇒ Object (readonly)
Returns the value of attribute st.
2 3 4 |
# File 'lib/gviz/edge.rb', line 2 def st @st end |
#st_port ⇒ Object (readonly)
Returns the value of attribute st_port.
2 3 4 |
# File 'lib/gviz/edge.rb', line 2 def st_port @st_port end |
Instance Method Details
#nodes ⇒ Object
16 17 18 |
# File 'lib/gviz/edge.rb', line 16 def nodes [st, ed] end |
#to_s ⇒ Object
9 10 11 12 13 14 |
# File 'lib/gviz/edge.rb', line 9 def to_s stp = ":#{st_port}" if st_port edp = ":#{ed_port}" if ed_port edge = $graph_type==:graph ? "--" : "->" "#{st}#{stp} #{edge} #{ed}#{edp}" end |