class ChaosDetector::ChaosGraphs::ModuleNode

Consider putting action/event in this class and naming it accordingly

Attributes

root_node[R]
domain_name[R]
mod_path[R]
mod_type[R]

Public Class Methods

new(mod_name: nil, mod_path: nil, is_root: false, node_origin: nil, domain_name: nil, mod_type: nil, reduction: nil) click to toggle source
Calls superclass method ChaosDetector::GraphTheory::Node::new
# 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

Public Instance Methods

==(other) click to toggle source
# File lib/chaos_detector/chaos_graphs/module_node.rb, line 32
def ==(other)
  # TODO? Checking domain name vs path name due to mixins/metacoding:
  mod_name == other.mod_name &&
    mod_type == other.mod_type &&
    mod_path == other.mod_path
end
eql?(other) click to toggle source
# File lib/chaos_detector/chaos_graphs/module_node.rb, line 28
def eql?(other)
  self == other
end
graph_props() click to toggle source
# 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() click to toggle source
# File lib/chaos_detector/chaos_graphs/module_node.rb, line 23
def hash
  [mod_name, mod_type, mod_path].hash
  # [mod_name, mod_type, domain_name].hash
end
short_mod_type() click to toggle source
# File lib/chaos_detector/chaos_graphs/module_node.rb, line 57
def short_mod_type
  mod_type && "(#{mod_type[0]})"
end
short_path() click to toggle source
# File lib/chaos_detector/chaos_graphs/module_node.rb, line 61
def short_path
  ChaosDetector::Utils::StrUtil.humanize_module(@mod_path, sep_token: '/')
end
subtitle() click to toggle source
# File lib/chaos_detector/chaos_graphs/module_node.rb, line 43
def subtitle
  '%s[%s]' % [short_mod_type, domain_name]
end
title() click to toggle source
# File lib/chaos_detector/chaos_graphs/module_node.rb, line 39
def title
  mod_name
end
to_info() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
Calls superclass method ChaosDetector::GraphTheory::Node#to_s
# File lib/chaos_detector/chaos_graphs/module_node.rb, line 73
def to_s
  [super, domain_name, @mod_type, short_path].join(', ')
end