Class: Graph::Edge
- Inherits:
-
Object
- Object
- Graph::Edge
- Defined in:
- lib/graph.rb
Overview
An edge. This class is just a wrapper around a hash of attributes since in version <= 0.1.5 edges were simple hashes
Instance Attribute Summary collapse
-
#attrs ⇒ Object
Returns the value of attribute attrs.
Instance Method Summary collapse
-
#==(other) ⇒ Object
compare two edges.
-
#initialize(attrs = nil) ⇒ Edge
constructor
A new instance of Edge.
- #method_missing(method, *args, &block) ⇒ Object
- #update(h) ⇒ Object
Constructor Details
#initialize(attrs = nil) ⇒ Edge
Returns a new instance of Edge.
88 89 90 |
# File 'lib/graph.rb', line 88 def initialize(attrs=nil) @attrs = attrs || {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/graph.rb', line 104 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.
86 87 88 |
# File 'lib/graph.rb', line 86 def attrs @attrs end |