class Controls::SecurityControlCoverage

A representation of the SecuritControl resource with coverage information

Public Instance Methods

<=>(other) click to toggle source

Allows for comparison with other objects with coverage information

@return [Fixnum] returns one of the following based on the percent of

assets that are covered -1 (less than `other`), 0 (equal to `other`),
or 1 (greater than `other`)
# File lib/controls/objects/security_control_coverage.rb, line 16
def <=>(other)
  return unless other.respond_to? :coverage
  coverage.percent_covered <=> other.coverage.percent_covered
end
respond_to?(method_name, *) click to toggle source
review
  • shouldn't this be covered by the Dish coercion?

@return [Boolean] true if the method is :coverage otherwise calls

`Dish::Plate#method_missing`
Calls superclass method
# File lib/controls/objects/security_control_coverage.rb, line 24
def respond_to?(method_name, *)
  if method_name.eql? :coverage
    true
  else
    super
  end
end
to_s() click to toggle source

The title of the security control

@return [String]

# File lib/controls/objects/security_control_coverage.rb, line 53
def to_s
  title
end
without_coverage() click to toggle source

Converts the object into a {Controls::SecurityControl} by name and whether it is enabled/disabled

@return {Controls::SecurityControl}

# File lib/controls/objects/security_control_coverage.rb, line 36
def without_coverage
  Controls::SecurityControl.new(enabled: enabled, name: name)
end
without_coverage!() click to toggle source

Removes the coverage from the {SecurityControlCoverage} object, making it equivalent to a {SecurityControl} in terms of duck-typing

@return {Controls::SecurityControl}

# File lib/controls/objects/security_control_coverage.rb, line 44
def without_coverage!
  @_original_hash.delete_if do |key, _value|
    not %w[enabled name].include?(key)
  end
end