Class: Crystalball::MapGenerator::ObjectSourcesDetector::HierarchyFetcher
- Inherits:
-
Object
- Object
- Crystalball::MapGenerator::ObjectSourcesDetector::HierarchyFetcher
- Defined in:
- lib/crystalball/map_generator/object_sources_detector/hierarchy_fetcher.rb
Overview
Class to get full hierarchy of a module(including singleton_class)
Instance Attribute Summary collapse
-
#stop_modules ⇒ Object
readonly
Returns the value of attribute stop_modules.
Instance Method Summary collapse
-
#ancestors_for(mod) ⇒ Array<Module>
List of ancestors of a module.
-
#initialize(stop_modules = []) ⇒ HierarchyFetcher
constructor
A new instance of HierarchyFetcher.
Constructor Details
#initialize(stop_modules = []) ⇒ HierarchyFetcher
Returns a new instance of HierarchyFetcher.
12 13 14 |
# File 'lib/crystalball/map_generator/object_sources_detector/hierarchy_fetcher.rb', line 12 def initialize(stop_modules = []) @stop_modules = stop_modules end |
Instance Attribute Details
#stop_modules ⇒ Object (readonly)
Returns the value of attribute stop_modules.
8 9 10 |
# File 'lib/crystalball/map_generator/object_sources_detector/hierarchy_fetcher.rb', line 8 def stop_modules @stop_modules end |
Instance Method Details
#ancestors_for(mod) ⇒ Array<Module>
Returns list of ancestors of a module.
18 19 20 |
# File 'lib/crystalball/map_generator/object_sources_detector/hierarchy_fetcher.rb', line 18 def ancestors_for(mod) (pick_ancestors(mod) + pick_ancestors(mod.singleton_class)).uniq end |