Class: Node
- Inherits:
-
Object
- Object
- Node
- Defined in:
- lib/rgraph/node.rb
Instance Attribute Summary collapse
-
#neighbours ⇒ Object
Returns the value of attribute neighbours.
Instance Method Summary collapse
- #degree ⇒ Object
-
#initialize(arg) ⇒ Node
constructor
A new instance of Node.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(arg) ⇒ Node
Returns a new instance of Node.
4 5 6 7 |
# File 'lib/rgraph/node.rb', line 4 def initialize(arg) @args = arg @neighbours = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
13 14 15 16 |
# File 'lib/rgraph/node.rb', line 13 def method_missing(name, *args) super unless args.empty? @args[name] end |
Instance Attribute Details
#neighbours ⇒ Object
Returns the value of attribute neighbours.
2 3 4 |
# File 'lib/rgraph/node.rb', line 2 def neighbours @neighbours end |
Instance Method Details
#degree ⇒ Object
9 10 11 |
# File 'lib/rgraph/node.rb', line 9 def degree @neighbours.size end |