Class: Controls::CoverageInformation

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

Overview

A representation of the CoverageInformation for SecurityControl or Configuration coverage

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Fixnum

Allows for sorting of objects that have :coverage (Controls::CoverageInformation)

Returns:

  • (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`)



12
13
14
15
# File 'lib/controls/objects/coverage_information.rb', line 12

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

#respond_to?(method_name) ⇒ Boolean

review
  • shouldn’t this be covered by the Dish coercion?

Returns:

  • (Boolean)

    true if the method is :percent_covered otherwise calls ‘Dish::Plate#method_missing`



20
21
22
23
24
25
26
# File 'lib/controls/objects/coverage_information.rb', line 20

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