Class: Kolekti::MemoryPersistenceStrategy

Inherits:
PersistenceStrategy show all
Defined in:
lib/kolekti/memory_persistence_strategy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMemoryPersistenceStrategy

Returns a new instance of MemoryPersistenceStrategy.



7
8
9
10
11
# File 'lib/kolekti/memory_persistence_strategy.rb', line 7

def initialize
  @tree_metric_results = []
  @hotspot_metric_results = []
  @related_hotspot_metric_results = []
end

Instance Attribute Details

#hotspot_metric_resultsObject (readonly)

Returns the value of attribute hotspot_metric_results.



5
6
7
# File 'lib/kolekti/memory_persistence_strategy.rb', line 5

def hotspot_metric_results
  @hotspot_metric_results
end

Returns the value of attribute related_hotspot_metric_results.



5
6
7
# File 'lib/kolekti/memory_persistence_strategy.rb', line 5

def related_hotspot_metric_results
  @related_hotspot_metric_results
end

#tree_metric_resultsObject (readonly)

Returns the value of attribute tree_metric_results.



5
6
7
# File 'lib/kolekti/memory_persistence_strategy.rb', line 5

def tree_metric_results
  @tree_metric_results
end

Instance Method Details

#create_hotspot_metric_result(metric_configuration, module_name, line, message) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/kolekti/memory_persistence_strategy.rb', line 22

def create_hotspot_metric_result(metric_configuration, module_name, line, message)
  result = {
    metric_configuration: metric_configuration,
    module_name: module_name,
    line: line,
    message: message
  }
  @hotspot_metric_results << result
  result
end


33
34
35
36
37
38
39
40
41
42
# File 'lib/kolekti/memory_persistence_strategy.rb', line 33

def create_related_hotspot_metric_results(metric_configuration, results)
  related_results = []

  results.each do |result|
    result = create_hotspot_metric_result(metric_configuration, result['module_name'], result['line'], result['message'])
    related_results << result
  end

  related_hotspot_metric_results << related_results
end

#create_tree_metric_result(metric_configuration, module_name, value, granularity) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/kolekti/memory_persistence_strategy.rb', line 13

def create_tree_metric_result(metric_configuration, module_name, value, granularity)
  @tree_metric_results << {
    metric_configuration: metric_configuration,
    module_name: module_name,
    value: value,
    granularity: granularity
  }
end