Class: ExplorerBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/exploration/explorer_builder.rb

Overview

All build methods must return an object that implements Explorable.

Instance Method Summary collapse

Instance Method Details

#build_ruby_explorerObject

Builds Explorer for Ruby programs. This explorer picks up:

  • Classes

    • Generalization relationships

    • Aggregation relationships

    • Dependency relationships

    • Implementation relationships

  • Modules

    • Dependency relationships

    • Implementation relationships



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/exploration/explorer_builder.rb', line 24

def build_ruby_explorer
  agg = AggregationRelation.new
  dep = DependencyRelation.new
  par = GeneralizationRelation.new
  imp = ImplementsRelation.new

  class_method_entity = MethodEntity.new
  class_method_entity.add_explorer agg
  class_method_entity.add_explorer dep

  module_method_entity = MethodEntity.new
  module_method_entity.add_explorer dep

  class_entity = ClassEntity.new
  class_entity.add_explorer class_method_entity
  class_entity.add_explorer par
  class_entity.add_explorer imp
  module_entity = ModuleEntity.new
  module_entity.add_explorer module_entity
  module_entity.add_explorer class_entity
  module_entity.add_explorer module_method_entity
  module_entity.add_explorer imp

  block_entity = BlockEntity.new
  block_entity.add_explorer module_entity
  block_entity.add_explorer class_entity

  root = RootEntity.new
  root.add_explorer class_entity
  root.add_explorer module_entity
  root.add_explorer block_entity

  return root
end