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
Constructor Details
#initialize(attrs = nil) ⇒ Edge
Returns a new instance of Edge.
80 81 82 |
# File 'lib/graph.rb', line 80 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
92 93 94 |
# File 'lib/graph.rb', line 92 def method_missing(method, *args, &block) @attrs.send(method, *args, &block) end |
Instance Attribute Details
#attrs ⇒ Object
Returns the value of attribute attrs.
78 79 80 |
# File 'lib/graph.rb', line 78 def attrs @attrs end |
Instance Method Details
#==(other) ⇒ Object
compare two edges
86 87 88 89 90 |
# File 'lib/graph.rb', line 86 def ==(other) return false if !other.is_a?(Edge) @attrs == other.attrs end |