Class: GV::Component
- Inherits:
-
Object
- Object
- GV::Component
- Defined in:
- lib/gv.rb
Overview
Common super-class for edges, nodes and graphs
Instance Attribute Summary collapse
-
#graph ⇒ Graph, SubGraph
readonly
The graph this component belongs to.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#[](attr) ⇒ Object
Retrieves the value of an attribute.
-
#[]=(attr, value) ⇒ Object
Sets an attribute.
- #hash ⇒ Object
-
#html(string) ⇒ Object
Creates an HTML label.
-
#name ⇒ String
The component’s name.
Instance Attribute Details
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
87 88 89 |
# File 'lib/gv.rb', line 87 def ==(other) other.is_a?(Component) && ptr == other.ptr end |
#[](attr) ⇒ Object
Retrieves the value of an attribute
110 111 112 |
# File 'lib/gv.rb', line 110 def [](attr) Libcgraph.agget(ptr, attr.to_s) end |
#[]=(attr, value) ⇒ Object
Sets an attribute
102 103 104 |
# File 'lib/gv.rb', line 102 def []=(attr, value) Libcgraph.agsafeset(ptr, attr.to_s, value.to_s, '') end |
#hash ⇒ Object
83 84 85 |
# File 'lib/gv.rb', line 83 def hash ptr.hash end |
#html(string) ⇒ Object
Creates an HTML label
75 76 77 78 79 80 81 |
# File 'lib/gv.rb', line 75 def html(string) ptr = Libcgraph.agstrdup_html(graph.ptr, string) string = ptr.read_string Libcgraph.agstrfree graph.ptr, ptr string end |
#name ⇒ String
Returns the component’s name.
94 95 96 |
# File 'lib/gv.rb', line 94 def name Libcgraph.agnameof ptr end |