Class: Controls::ConfigurationCoverage
- Inherits:
-
Dish::Plate
- Object
- Dish::Plate
- Controls::ConfigurationCoverage
- Includes:
- Comparable
- Defined in:
- lib/controls/objects/configuration_coverage.rb
Overview
A representation of the Configuration resource with coverage information
Instance Method Summary collapse
-
#<=>(other) ⇒ Fixnum
Allows for comparison with other objects with coverage information.
-
#respond_to?(method_name) ⇒ Boolean
- review
-
define this in Dish?.
-
-
#to_s ⇒ String
The title of the configuration.
-
#without_coverage ⇒ Controls::Configuration
Converts the object into a Configuration by name and whether it is enabled/disabled.
-
#without_coverage! ⇒ Controls::Configuration
Removes the coverage from the ConfigurationCoverage object, making it equivalent to a Configuration in terms of duck-typing.
Instance Method Details
#<=>(other) ⇒ Fixnum
Allows for comparison with other objects with coverage information
16 17 18 19 |
# File 'lib/controls/objects/configuration_coverage.rb', line 16 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?
-
22 23 24 25 26 27 28 |
# File 'lib/controls/objects/configuration_coverage.rb', line 22 def respond_to?(method_name, *) if method_name.eql? :coverage true else super end end |
#to_s ⇒ String
The title of the configuration
51 52 53 |
# File 'lib/controls/objects/configuration_coverage.rb', line 51 def to_s title end |
#without_coverage ⇒ Controls::Configuration
Converts the object into a Controls::Configuration by name and whether it is enabled/disabled
34 35 36 |
# File 'lib/controls/objects/configuration_coverage.rb', line 34 def without_coverage Controls::Configuration.new(enabled: enabled, name: name) end |
#without_coverage! ⇒ Controls::Configuration
Removes the coverage from the Controls::ConfigurationCoverage object, making it equivalent to a Controls::Configuration in terms of duck-typing
42 43 44 45 46 |
# File 'lib/controls/objects/configuration_coverage.rb', line 42 def without_coverage! @_original_hash.delete_if do |key, _value| !%w(enabled name).include?(key) end end |