Class: Rubigraph::Vertex
- Inherits:
-
Object
- Object
- Rubigraph::Vertex
- Defined in:
- lib/rubigraph.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #color=(c) ⇒ Object
- #colour=(c) ⇒ Object
- #fontcolor=(c) ⇒ Object
- #fontfamily=(f) ⇒ Object
- #fontsize=(s) ⇒ Object
-
#initialize(id = Rubigraph.genid) ⇒ Vertex
constructor
A new instance of Vertex.
- #label=(l) ⇒ Object
- #labelpos=(p) ⇒ Object
- #remove ⇒ Object
- #set_attribute(att, value) ⇒ Object
- #set_attributes(attrs) ⇒ Object
- #shape=(s) ⇒ Object
- #shapedetail=(d) ⇒ Object
- #size=(s) ⇒ Object
Constructor Details
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/rubigraph.rb', line 14 def id @id end |
Instance Method Details
#color=(c) ⇒ Object
35 36 37 |
# File 'lib/rubigraph.rb', line 35 def color=(c) set_attribute('color', c) end |
#colour=(c) ⇒ Object
39 40 41 |
# File 'lib/rubigraph.rb', line 39 def colour=(c) self.color=(c) end |
#fontcolor=(c) ⇒ Object
63 64 65 |
# File 'lib/rubigraph.rb', line 63 def fontcolor=(c) set_attribute('fontcolor', c) end |
#fontfamily=(f) ⇒ Object
67 68 69 70 |
# File 'lib/rubigraph.rb', line 67 def fontfamily=(f) # TODO: should assert 'Helvetica' | 'Times Roman' set_attribute('fontfamily', f) end |
#fontsize=(s) ⇒ Object
72 73 74 75 |
# File 'lib/rubigraph.rb', line 72 def fontsize=(s) # TODO: should assert 10, 12, 18. 24 set_attribute('fontsize', s) end |
#label=(l) ⇒ Object
51 52 53 |
# File 'lib/rubigraph.rb', line 51 def label=(l) set_attribute('label', l) end |
#labelpos=(p) ⇒ Object
55 56 57 |
# File 'lib/rubigraph.rb', line 55 def labelpos=(p) set_attribute('labelpos', p) end |
#remove ⇒ Object
21 22 23 |
# File 'lib/rubigraph.rb', line 21 def remove Rubigraph.call('ubigraph.remove_vertex', @id) end |
#set_attribute(att, value) ⇒ Object
25 26 27 |
# File 'lib/rubigraph.rb', line 25 def set_attribute(att, value) Rubigraph.call('ubigraph.set_vertex_attribute', @id, att, value.to_s) end |
#set_attributes(attrs) ⇒ Object
29 30 31 32 33 |
# File 'lib/rubigraph.rb', line 29 def set_attributes(attrs) attrs.each do |k, v| Rubigraph.call('ubigraph.set_vertex_attribute', @id, k, v.to_s) end end |
#shape=(s) ⇒ Object
43 44 45 |
# File 'lib/rubigraph.rb', line 43 def shape=(s) set_attribute('shape', s) end |
#shapedetail=(d) ⇒ Object
47 48 49 |
# File 'lib/rubigraph.rb', line 47 def shapedetail=(d) set_attribute('shapedetail', d) end |
#size=(s) ⇒ Object
59 60 61 |
# File 'lib/rubigraph.rb', line 59 def size=(s) set_attribute('size', s) end |