Class: Inch::API::Compare::Codebases

Inherits:
Object
  • Object
show all
Defined in:
lib/inch/api/compare/codebases.rb

Instance Method Summary collapse

Constructor Details

#initialize(codebase1, codebase2) ⇒ Codebases

Returns a new instance of Codebases.



5
6
7
# File 'lib/inch/api/compare/codebases.rb', line 5

def initialize(codebase1, codebase2)
  @a, @b = codebase1, codebase2
end

Instance Method Details

#added_objectsObject



9
10
11
# File 'lib/inch/api/compare/codebases.rb', line 9

def added_objects
  comparisons.select(&:added?)
end

#comparisonsObject



25
26
27
28
29
30
31
# File 'lib/inch/api/compare/codebases.rb', line 25

def comparisons
  __objects_names.map do |fullname|
    object1 = @a.objects.find(fullname)
    object2 = @b.objects.find(fullname)
    Compare::CodeObjects.new(object1, object2)
  end
end

#degraded_objectsObject



17
18
19
# File 'lib/inch/api/compare/codebases.rb', line 17

def degraded_objects
  comparisons.select(&:degraded?)
end

#find(fullname) ⇒ Object



33
34
35
36
37
# File 'lib/inch/api/compare/codebases.rb', line 33

def find(fullname)
  comparisons.detect do |comparison|
    comparison.fullname == fullname
  end
end

#improved_objectsObject



13
14
15
# File 'lib/inch/api/compare/codebases.rb', line 13

def improved_objects
  comparisons.select(&:improved?)
end

#removed_objectsObject



21
22
23
# File 'lib/inch/api/compare/codebases.rb', line 21

def removed_objects
  comparisons.select(&:removed?)
end