Class: Graph::Node
- Inherits:
-
Object
- Object
- Graph::Node
- Defined in:
- lib/graph.rb
Overview
A node. This class is just a wrapper around a hash of attributes since in version <= 0.1.5 nodes were simple hashes
Instance Attribute Summary collapse
-
#attrs ⇒ Object
Returns the value of attribute attrs.
Instance Method Summary collapse
-
#==(other) ⇒ Object
compare two nodes.
-
#initialize(attrs = nil) ⇒ Node
constructor
A new instance of Node.
- #method_missing(method, *args, &block) ⇒ Object
- #update(h) ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/graph.rb', line 75 def method_missing(method, *args, &block) return @attrs[method.to_sym] if @attrs.has_key? method.to_sym return @attrs[method.to_s] if @attrs.has_key? method.to_s @attrs.send(method, *args, &block) end |
Instance Attribute Details
#attrs ⇒ Object
Returns the value of attribute attrs.
55 56 57 |
# File 'lib/graph.rb', line 55 def attrs @attrs end |