Class: Rigor::ModuleGraph::Stats::NamespaceMetrics

Inherits:
Data
  • Object
show all
Defined in:
lib/rigor/module_graph/stats.rb

Overview

The five numbers for one namespace, exposed as a Data value so callers can treat the result like a row of a table.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fan_inObject (readonly)

Returns the value of attribute fan_in

Returns:

  • (Object)

    the current value of fan_in



99
100
101
# File 'lib/rigor/module_graph/stats.rb', line 99

def fan_in
  @fan_in
end

#fan_outObject (readonly)

Returns the value of attribute fan_out

Returns:

  • (Object)

    the current value of fan_out



99
100
101
# File 'lib/rigor/module_graph/stats.rb', line 99

def fan_out
  @fan_out
end

#internalObject (readonly)

Returns the value of attribute internal

Returns:

  • (Object)

    the current value of internal



99
100
101
# File 'lib/rigor/module_graph/stats.rb', line 99

def internal
  @internal
end

#namespaceObject (readonly)

Returns the value of attribute namespace

Returns:

  • (Object)

    the current value of namespace



99
100
101
# File 'lib/rigor/module_graph/stats.rb', line 99

def namespace
  @namespace
end

#nodesObject (readonly)

Returns the value of attribute nodes

Returns:

  • (Object)

    the current value of nodes



99
100
101
# File 'lib/rigor/module_graph/stats.rb', line 99

def nodes
  @nodes
end

Instance Method Details

#to_hObject



106
107
108
109
110
111
112
113
114
115
# File 'lib/rigor/module_graph/stats.rb', line 106

def to_h
  {
    "namespace" => namespace,
    "nodes" => nodes,
    "fan_out" => fan_out,
    "fan_in" => fan_in,
    "internal" => internal,
    "total" => total
  }
end

#totalObject

Sum of edges originating in the namespace (fan_out + internal).



102
103
104
# File 'lib/rigor/module_graph/stats.rb', line 102

def total
  fan_out + internal
end