Class: Hashira::Hotspots::FileCost
- Inherits:
-
Data
- Object
- Data
- Hashira::Hotspots::FileCost
- Defined in:
- lib/hashira/hotspots/file_cost.rb
Instance Attribute Summary collapse
-
#churn ⇒ Object
readonly
Returns the value of attribute churn.
-
#cognitive ⇒ Object
readonly
Returns the value of attribute cognitive.
-
#duplication ⇒ Object
readonly
Returns the value of attribute duplication.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
Instance Attribute Details
#churn ⇒ Object (readonly)
Returns the value of attribute churn
7 8 9 |
# File 'lib/hashira/hotspots/file_cost.rb', line 7 def churn @churn end |
#cognitive ⇒ Object (readonly)
Returns the value of attribute cognitive
7 8 9 |
# File 'lib/hashira/hotspots/file_cost.rb', line 7 def cognitive @cognitive end |
#duplication ⇒ Object (readonly)
Returns the value of attribute duplication
7 8 9 |
# File 'lib/hashira/hotspots/file_cost.rb', line 7 def duplication @duplication end |
#file ⇒ Object (readonly)
Returns the value of attribute file
7 8 9 |
# File 'lib/hashira/hotspots/file_cost.rb', line 7 def file @file end |
Instance Method Details
#cells ⇒ Object
16 |
# File 'lib/hashira/hotspots/file_cost.rb', line 16 def cells = [file, cognitive, duplication, churn, rank] |
#cost ⇒ Object
8 |
# File 'lib/hashira/hotspots/file_cost.rb', line 8 def cost = cognitive + duplication |
#effective_churn ⇒ Object
12 |
# File 'lib/hashira/hotspots/file_cost.rb', line 12 def effective_churn = [churn, CHURN_FLOOR].max |
#rank ⇒ Object
10 |
# File 'lib/hashira/hotspots/file_cost.rb', line 10 def rank = cost * effective_churn |
#to_h ⇒ Object
14 |
# File 'lib/hashira/hotspots/file_cost.rb', line 14 def to_h = { file:, cognitive:, duplication:, churn:, cost:, rank: } |