Sha256: 21590bde824d01c91a80df99101f358f4be6a644fbe26473df1feec7fcac4422

Contents?: true

Size: 1.42 KB

Versions: 20

Compression:

Stored size: 1.42 KB

Contents

require 'fitting/statistics/cover_error_enum'
require 'fitting/records/unit/request'
require 'fitting/storage/white_list'
require 'fitting/records/documented/request'

module Fitting
  class Statistics
    class TemplateCoverErrorEnum
      def initialize(tested_requests, config)
        @tested_requests = tested_requests
        @config = config
      end

      def stats
        "#{white_statistics}\n\n"
      end

      def white_statistics
        @white_statistics ||= Fitting::Statistics::CoverErrorEnum.new(white_unit)
      end

      def white_unit
        @white_unit_requests ||= documented_requests_white.inject([]) do |res, documented_request|
          res.push(Fitting::Records::Unit::Request.new(documented_request, @tested_requests))
        end
      end

      def documented_requests_white
        @documented_requests_white ||= documented.find_all(&:white)
      end

      def documented
        @documented_requests ||= @config.tomogram.to_a.inject([]) do |res, tomogram_request|
          res.push(Fitting::Records::Documented::Request.new(tomogram_request, white_list.to_a))
        end
      end

      def white_list
        @white_list ||= Fitting::Storage::WhiteList.new(
          @config.prefix,
          @config.white_list,
          @config.resource_white_list,
          @config.include_resources,
          @config.include_actions,
          @config.tomogram.to_resources
        )
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
fitting-2.18.3 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.18.2 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.18.1 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.18.0 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.17.0 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.16.1 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.16.0 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.15.0 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.14.1 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.14.0 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.13.1 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.13.0 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.12.1 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.12.0 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.11.0 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.10.0 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.9.1 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.9.0 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.8.1 lib/fitting/statistics/template_cover_error_enum.rb
fitting-2.8.0 lib/fitting/statistics/template_cover_error_enum.rb