Class: GraphML::Node
- Inherits:
-
Object
- Object
- GraphML::Node
- Defined in:
- lib/ruby-graphml.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#id ⇒ Object
Returns the value of attribute id.
-
#in_edges ⇒ Object
Returns the value of attribute in_edges.
-
#out_edges ⇒ Object
Returns the value of attribute out_edges.
Instance Method Summary collapse
-
#initialize(attrs, graph) ⇒ Node
constructor
A new instance of Node.
- #key(name) ⇒ Object
Constructor Details
#initialize(attrs, graph) ⇒ Node
Returns a new instance of Node.
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/ruby-graphml.rb', line 59 def initialize(attrs, graph) attrs.each do |key, val| if key == 'id' @id = val end end @data = {} @in_edges = [] @out_edges = [] @graph = graph end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
58 59 60 |
# File 'lib/ruby-graphml.rb', line 58 def data @data end |
#id ⇒ Object
Returns the value of attribute id.
58 59 60 |
# File 'lib/ruby-graphml.rb', line 58 def id @id end |
#in_edges ⇒ Object
Returns the value of attribute in_edges.
58 59 60 |
# File 'lib/ruby-graphml.rb', line 58 def in_edges @in_edges end |
#out_edges ⇒ Object
Returns the value of attribute out_edges.
58 59 60 |
# File 'lib/ruby-graphml.rb', line 58 def out_edges @out_edges end |
Instance Method Details
#key(name) ⇒ Object
71 72 73 74 75 76 |
# File 'lib/ruby-graphml.rb', line 71 def key(name) key_obj = @graph.key_names[name] val = @data[key_obj.id] return key_obj.default if val.nil? val end |