Class: ForemanOpenscap::ConfigNameService
- Inherits:
-
Object
- Object
- ForemanOpenscap::ConfigNameService
- Defined in:
- app/services/foreman_openscap/config_name_service.rb
Instance Attribute Summary collapse
-
#configs ⇒ Object
readonly
Returns the value of attribute configs.
Instance Method Summary collapse
- #all_available_except(type) ⇒ Object
- #all_available_with_overrides_except(type) ⇒ Object
- #all_except(type) ⇒ Object
- #config_for(type) ⇒ Object
-
#initialize ⇒ ConfigNameService
constructor
A new instance of ConfigNameService.
Constructor Details
#initialize ⇒ ConfigNameService
Returns a new instance of ConfigNameService.
5 6 7 8 9 10 11 |
# File 'app/services/foreman_openscap/config_name_service.rb', line 5 def initialize @configs = [ ForemanOpenscap::ClientConfig::Ansible.new(Policy), ForemanOpenscap::ClientConfig::Puppet.new, ForemanOpenscap::ClientConfig::Manual.new ] end |
Instance Attribute Details
#configs ⇒ Object (readonly)
Returns the value of attribute configs.
3 4 5 |
# File 'app/services/foreman_openscap/config_name_service.rb', line 3 def configs @configs end |
Instance Method Details
#all_available_except(type) ⇒ Object
21 22 23 |
# File 'app/services/foreman_openscap/config_name_service.rb', line 21 def all_available_except(type) all_except(type).select(&:available?) end |
#all_available_with_overrides_except(type) ⇒ Object
25 26 27 |
# File 'app/services/foreman_openscap/config_name_service.rb', line 25 def all_available_with_overrides_except(type) all_available_except(type).select(&:managed_overrides?) end |
#all_except(type) ⇒ Object
17 18 19 |
# File 'app/services/foreman_openscap/config_name_service.rb', line 17 def all_except(type) @configs.reject { |config| config.type == type } end |
#config_for(type) ⇒ Object
13 14 15 |
# File 'app/services/foreman_openscap/config_name_service.rb', line 13 def config_for(type) @configs.find { |config| config.type == type } end |