Class: ChaosDetector::ChaosGraphs::ModuleNode
  
  
  
Overview
  
    
Consider putting action/event in this class and naming it accordingly
   
 
  
  Constant Summary
  
  
  GraphTheory::Node::ROOT_NODE_NAME
  Class Attribute Summary collapse
  
  Instance Attribute Summary collapse
  
  
  
  
  #is_root, #node_origin, #reduction
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  #merge!, #name, #root?
  Constructor Details
  
    
  
  
    #initialize(mod_name: nil, mod_path: nil, is_root: false, node_origin: nil, domain_name: nil, mod_type: nil, reduction: nil)  ⇒ ModuleNode 
  
  
  
  
    
Returns a new instance of ModuleNode.
   
 
  
  
    | 
16
17
18
19
20
21 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 16
def initialize(mod_name: nil, mod_path: nil, is_root: false, node_origin: nil, domain_name: nil, mod_type: nil, reduction: nil)
  super(name: mod_name, root: is_root, node_origin: node_origin, reduction: reduction)
  @domain_name = domain_name&.to_s
  @mod_path = mod_path
  @mod_type = mod_type
end | 
 
  
 
  
    Class Attribute Details
    
      
      
      
  
  
    .root_node(force_new: false)  ⇒ Object  
  
  
  
  
    
Returns the value of attribute root_node.
   
 
  
  
    | 
78
79
80 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 78
def root_node
  @root_node
end | 
 
    
   
  
    Instance Attribute Details
    
      
      
      
  
  
    #domain_name  ⇒ Object  
  
  
  
  
    
Returns the value of attribute domain_name.
   
 
  
  
    | 
12
13
14 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 12
def domain_name
  @domain_name
end | 
 
    
      
      
      
  
  
    #mod_path  ⇒ Object  
  
  
  
  
    
:unknown, :module, :class
   
 
  
  
    | 
11
12
13 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 11
def mod_path
  @mod_path
end | 
 
    
      
      
      
  
  
    #mod_type  ⇒ Object  
  
  
  
  
    
:unknown, :module, :class
   
 
  
  
    | 
10
11
12 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 10
def mod_type
  @mod_type
end | 
 
    
   
  
    Instance Method Details
    
      
  
  
    #==(other)  ⇒ Object 
  
  
  
  
    | 
32
33
34
35
36
37 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 32
def ==(other)
    mod_name == other.mod_name &&
    mod_type == other.mod_type &&
    mod_path == other.mod_path
end | 
 
    
      
  
  
    #eql?(other)  ⇒ Boolean 
  
  
  
  
    | 
28
29
30 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 28
def eql?(other)
  self == other
end | 
 
    
      
  
  
    #graph_props  ⇒ Object 
  
  
  
  
    | 
47
48
49
50
51
52
53
54
55 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 47
def graph_props
  props = super
  if reduction
    props.merge!(
      cardinality_functions: reduction.reduction_count
    )
  end
  super.merge(props)
end | 
 
    
      
  
  
    #hash  ⇒ Object 
  
  
  
  
    | 
23
24
25
26 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 23
def hash
  [mod_name, mod_type, mod_path].hash
  end | 
 
    
      
  
  
    #short_mod_type  ⇒ Object 
  
  
  
  
    | 
57
58
59 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 57
def short_mod_type
  mod_type && "(#{mod_type[0]})"
end | 
 
    
      
    
      
  
  
    #subtitle  ⇒ Object 
  
  
  
  
    | 
43
44
45 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 43
def subtitle
  '%s[%s]' % [short_mod_type, domain_name]
end | 
 
    
      
  
  
    #title  ⇒ Object 
  
  
  
  
    | 
39
40
41 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 39
def title
  mod_name
end | 
 
    
      
  
  
    #to_info  ⇒ Object 
  
  
  
  
    | 
65
66
67 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 65
def to_info
  ChaosDetector::Stacker::ModInfo.new(mod_name: mod_name, mod_path: mod_path, mod_type: mod_type)
end | 
 
    
      
  
  
    #to_k  ⇒ Object 
  
  
  
  
    | 
69
70
71 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 69
def to_k
  ChaosDetector::Utils::StrUtil.snakeize([domain_name, mod_name, @mod_type, @mod_path].compact.map(&:to_s))
end | 
 
    
      
  
  
    #to_s  ⇒ Object 
  
  
  
  
    | 
73
74
75 | # File 'lib/chaos_detector/chaos_graphs/module_node.rb', line 73
def to_s
  [super, domain_name, @mod_type, short_path].join(', ')
end |