Class: Hashira::Hotspots::FileCost

Inherits:
Data
  • Object
show all
Defined in:
lib/hashira/hotspots/file_cost.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#churnObject (readonly)

Returns the value of attribute churn

Returns:

  • (Object)

    the current value of churn



7
8
9
# File 'lib/hashira/hotspots/file_cost.rb', line 7

def churn
  @churn
end

#cognitiveObject (readonly)

Returns the value of attribute cognitive

Returns:

  • (Object)

    the current value of cognitive



7
8
9
# File 'lib/hashira/hotspots/file_cost.rb', line 7

def cognitive
  @cognitive
end

#duplicationObject (readonly)

Returns the value of attribute duplication

Returns:

  • (Object)

    the current value of duplication



7
8
9
# File 'lib/hashira/hotspots/file_cost.rb', line 7

def duplication
  @duplication
end

#fileObject (readonly)

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



7
8
9
# File 'lib/hashira/hotspots/file_cost.rb', line 7

def file
  @file
end

Instance Method Details

#cellsObject



16
# File 'lib/hashira/hotspots/file_cost.rb', line 16

def cells = [file, cognitive, duplication, churn, rank]

#costObject



8
# File 'lib/hashira/hotspots/file_cost.rb', line 8

def cost = cognitive + duplication

#effective_churnObject



12
# File 'lib/hashira/hotspots/file_cost.rb', line 12

def effective_churn = [churn, CHURN_FLOOR].max

#rankObject



10
# File 'lib/hashira/hotspots/file_cost.rb', line 10

def rank = cost * effective_churn

#to_hObject



14
# File 'lib/hashira/hotspots/file_cost.rb', line 14

def to_h = { file:, cognitive:, duplication:, churn:, cost:, rank: }