Class: Controls::ConfigurationCoverage

Inherits:
Dish::Plate
  • Object
show all
Includes:
Comparable
Defined in:
lib/controls/objects/configuration_coverage.rb

Overview

A representation of the Configuration resource with coverage information

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



11
12
13
14
# File 'lib/controls/objects/configuration_coverage.rb', line 11

def <=>(other)
  return unless other.respond_to? :coverage
  coverage.percent_covered <=> other.coverage.percent_covered
end

#respond_to?(method_name) ⇒ Boolean

review
  • define this in Dish?

Returns:

  • (Boolean)


17
18
19
20
21
22
23
# File 'lib/controls/objects/configuration_coverage.rb', line 17

def respond_to?(method_name, *)
  if method_name.eql? :coverage
    true
  else
    super
  end
end

#to_sString

The title of the configuration

Returns:

  • (String)


38
39
40
# File 'lib/controls/objects/configuration_coverage.rb', line 38

def to_s
  title
end

#without_coverageObject



25
26
27
# File 'lib/controls/objects/configuration_coverage.rb', line 25

def without_coverage
  Controls::Configuration.new(enabled: enabled, name: name)
end

#without_coverage!Object



29
30
31
32
33
# File 'lib/controls/objects/configuration_coverage.rb', line 29

def without_coverage!
  @_original_hash.delete_if do |key, _value|
    not %w[enabled name].include?(key)
  end
end