Class: MetricAdapter::ReekAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/adapters/reek_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(examiner) ⇒ ReekAdapter

Returns a new instance of ReekAdapter.



5
6
7
# File 'lib/adapters/reek_adapter.rb', line 5

def initialize(examiner)
  @examiner = examiner
end

Instance Attribute Details

#examinerObject (readonly)

Returns the value of attribute examiner.



3
4
5
# File 'lib/adapters/reek_adapter.rb', line 3

def examiner
  @examiner
end

Instance Method Details

#metricsObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/adapters/reek_adapter.rb', line 9

def metrics
  metrics = examiner.smells.map do |smell|
    line_numbers = Array(smell.lines).uniq
    line_numbers.map do |line|
      create_metric(smell, line)
    end
  end
  
  metrics.flatten
end