Sha256: ff1eabaa015dd978e177fdd4cc951282b944feee7ba03cd8d592d35c8f266917

Contents?: true

Size: 1.07 KB

Versions: 40

Compression:

Stored size: 1.07 KB

Contents

module Inch
  module API
    module Compare
      class Codebases
        def initialize(codebase1, codebase2)
          @a, @b = codebase1, codebase2
        end

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

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

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

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

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

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

        private

        def __objects_names
          fullnames = @a.objects.all.map(&:fullname) +
                    @b.objects.all.map(&:fullname)
          fullnames.uniq
        end
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
inch-0.5.7 lib/inch/api/compare/codebases.rb
inch-0.5.6 lib/inch/api/compare/codebases.rb
inch-0.5.5 lib/inch/api/compare/codebases.rb
inch-0.5.4 lib/inch/api/compare/codebases.rb
inch-0.5.3 lib/inch/api/compare/codebases.rb
inch-0.5.2 lib/inch/api/compare/codebases.rb
inch-0.5.1 lib/inch/api/compare/codebases.rb
inch-0.5.0 lib/inch/api/compare/codebases.rb
inch-0.5.0.rc11 lib/inch/api/compare/codebases.rb
inch-0.5.0.rc10 lib/inch/api/compare/codebases.rb
inch-0.5.0.rc9 lib/inch/api/compare/codebases.rb
inch-0.5.0.rc8 lib/inch/api/compare/codebases.rb
inch-0.5.0.rc7 lib/inch/api/compare/codebases.rb
inch-0.5.0.rc6 lib/inch/api/compare/codebases.rb
inch-0.5.0.rc5 lib/inch/api/compare/codebases.rb
inch-0.5.0.rc4 lib/inch/api/compare/codebases.rb
inch-0.4.10 lib/inch/api/compare/codebases.rb
inch-0.4.9 lib/inch/api/compare/codebases.rb
inch-0.4.8 lib/inch/api/compare/codebases.rb
inch-0.4.7 lib/inch/api/compare/codebases.rb