Class: RubyToUML::UMLInfoGenerator::UMLInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_to_uml/uml_info_generator/info_classes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(classes, modules, relationships) ⇒ UMLInfo

Returns a new instance of UMLInfo.



37
38
39
40
41
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 37

def initialize(classes, modules, relationships)
  @classes = classes
  @modules = modules
  @relationships = relationships
end

Instance Attribute Details

#classesObject (readonly)

Returns the value of attribute classes.



35
36
37
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 35

def classes
  @classes
end

#modulesObject (readonly)

Returns the value of attribute modules.



35
36
37
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 35

def modules
  @modules
end

#relationshipsObject (readonly)

Returns the value of attribute relationships.



35
36
37
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 35

def relationships
  @relationships
end

Instance Method Details

#class_instance_methodsObject



51
52
53
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 51

def class_instance_methods
  classes.map { |class_info| class_info.instance_methods_info.map(&:to_s).join("\n") }
end

#class_instance_variablesObject



67
68
69
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 67

def class_instance_variables
  classes.map(&:instance_variables_info)
end

#class_namesObject



43
44
45
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 43

def class_names
  classes.map(&:name)
end

#class_singleton_methodsObject



59
60
61
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 59

def class_singleton_methods
  classes.map { |class_info| class_info.singleton_methods_info.map(&:to_s).join("\n") }
end

#merge(other_uml_info) ⇒ Object



75
76
77
78
79
80
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 75

def merge(other_uml_info)
  unique_relationships = (relationships + other_uml_info.relationships).uniq
  unique_classes = merge_classes(classes, other_uml_info.classes)
  unique_modules = merge_modules(modules, other_uml_info.modules)
  UMLInfo.new(unique_classes, unique_modules, unique_relationships)
end

#module_instance_methodsObject



55
56
57
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 55

def module_instance_methods
  modules.map { |class_info| class_info.instance_methods_info.map(&:to_s).join("\n") }
end

#module_namesObject



47
48
49
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 47

def module_names
  modules.map(&:name)
end

#module_singleton_methodsObject



63
64
65
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 63

def module_singleton_methods
  modules.map { |class_info| class_info.singleton_methods_info.map(&:to_s).join("\n") }
end

#relationship_descriptionsObject



71
72
73
# File 'lib/ruby_to_uml/uml_info_generator/info_classes.rb', line 71

def relationship_descriptions
  relationships.map(&:to_s)
end