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

#typesObject (readonly)

Returns the value of attribute types

Returns:

  • (Object)

    the current value of types



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

def types
  @types
end

Instance Method Details

#instabilityObject



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

def instability
  total = efferent + afferent
  total.zero? ? 0.0 : efferent.fdiv(total)
end

#to_hObject



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

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