Sha256: 6cb18460260371025d7282e010dcf4cf2c42bedc25b0c523071941375f884c88

Contents?: true

Size: 1.69 KB

Versions: 10

Compression:

Stored size: 1.69 KB

Contents

module Inspec
  class RunData
    # {:duration=>0.018407, :controls=>{:total=>3, :passed=>{:total=>3}, :skipped=>{:total=>0}, :failed=>{:total=>0}}}
    Statistics = Struct.new(
      :duration,
      :controls
    ) do
      include HashLikeStruct
      def initialize(raw_stat_data)
        self.controls = Inspec::RunData::Statistics::Controls.new(raw_stat_data[:controls])
        self.duration = raw_stat_data[:duration]
      end
    end
    class Statistics
      Controls = Struct.new(
        :total,
        :passed,
        :skipped,
        :failed,
        :not_reviewed,
        :not_applicable,
        :error
      ) do
        include HashLikeStruct
        def initialize(raw_stat_ctl_data)
          self.total = raw_stat_ctl_data[:total]
          self.passed = Inspec::RunData::Statistics::Controls::Total.new(raw_stat_ctl_data[:passed][:total])
          self.failed = Inspec::RunData::Statistics::Controls::Total.new(raw_stat_ctl_data[:failed][:total])
          self.skipped = Inspec::RunData::Statistics::Controls::Total.new(raw_stat_ctl_data[:skipped][:total]) if raw_stat_ctl_data[:skipped]
          self.not_reviewed = Inspec::RunData::Statistics::Controls::Total.new(raw_stat_ctl_data[:not_reviewed][:total]) if raw_stat_ctl_data[:not_reviewed]
          self.not_applicable = Inspec::RunData::Statistics::Controls::Total.new(raw_stat_ctl_data[:not_applicable][:total]) if raw_stat_ctl_data[:not_applicable]
          self.error = Inspec::RunData::Statistics::Controls::Total.new(raw_stat_ctl_data[:error][:total]) if raw_stat_ctl_data[:error]
        end
      end
      class Controls
        Total = Struct.new(:total) do
          include HashLikeStruct
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
inspec-core-6.8.11 lib/inspec/run_data/statistics.rb
inspec-core-5.22.58 lib/inspec/run_data/statistics.rb
inspec-core-5.22.55 lib/inspec/run_data/statistics.rb
inspec-core-6.8.1 lib/inspec/run_data/statistics.rb
inspec-core-5.22.40 lib/inspec/run_data/statistics.rb
inspec-core-6.6.0 lib/inspec/run_data/statistics.rb
inspec-core-5.22.36 lib/inspec/run_data/statistics.rb
inspec-core-5.22.29 lib/inspec/run_data/statistics.rb
inspec-core-5.22.3 lib/inspec/run_data/statistics.rb
inspec-core-5.21.29 lib/inspec/run_data/statistics.rb