Class: Hashira::Analysis::Metric

Inherits:
Data
  • Object
show all
Defined in:
lib/hashira/analysis/metric.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#afferentObject (readonly)

Returns the value of attribute afferent

Returns:

  • (Object)

    the current value of afferent



5
6
7
# File 'lib/hashira/analysis/metric.rb', line 5

def afferent
  @afferent
end

#efferentObject (readonly)

Returns the value of attribute efferent

Returns:

  • (Object)

    the current value of efferent



5
6
7
# File 'lib/hashira/analysis/metric.rb', line 5

def efferent
  @efferent
end

#type_countObject (readonly)

Returns the value of attribute type_count

Returns:

  • (Object)

    the current value of type_count



5
6
7
# File 'lib/hashira/analysis/metric.rb', line 5

def type_count
  @type_count
end

Instance Method Details

#instabilityObject



6
7
8
9
# File 'lib/hashira/analysis/metric.rb', line 6

def instability
  total = efferent + afferent
  total.zero? ? 0.0 : efferent.to_f / total
end

#to_hObject



11
# File 'lib/hashira/analysis/metric.rb', line 11

def to_h = { tc: type_count, ca: afferent, ce: efferent, i: instability }