Class: ReFe::ModuleNode
- Inherits:
-
Object
- Object
- ReFe::ModuleNode
- Defined in:
- lib/refe/inheritancegraph.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #ancestors ⇒ Object
- #include(mod) ⇒ Object
-
#initialize(name) ⇒ ModuleNode
constructor
A new instance of ModuleNode.
- #inspect ⇒ Object
Constructor Details
#initialize(name) ⇒ ModuleNode
Returns a new instance of ModuleNode.
72 73 74 75 |
# File 'lib/refe/inheritancegraph.rb', line 72 def initialize( name ) @name = name @included = [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
77 78 79 |
# File 'lib/refe/inheritancegraph.rb', line 77 def name @name end |
Instance Method Details
#ancestors ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/refe/inheritancegraph.rb', line 87 def ancestors result = [self] @included.each do |mod| result.concat mod.ancestors end result.uniq # uniq is ReFe specific end |
#include(mod) ⇒ Object
83 84 85 |
# File 'lib/refe/inheritancegraph.rb', line 83 def include( mod ) @included.unshift mod end |
#inspect ⇒ Object
79 80 81 |
# File 'lib/refe/inheritancegraph.rb', line 79 def inspect "\#<#{self.class} #{@name}>" end |