class Kitchen::Pulumi::InSpecOptionsMapper
Kitchen::Pulumi::InSpecOptionsMapper
maps system configuration attributes to an InSpec
options hash.
Constants
- SYSTEM_ATTRIBUTES_TO_OPTIONS
Attributes
system_attributes_to_options[RW]
Public Class Methods
new()
click to toggle source
# File lib/kitchen/pulumi/inspec_options_mapper.rb, line 64 def initialize self.system_attributes_to_options = ::Kitchen::Pulumi::InSpecOptionsMapper::SYSTEM_ATTRIBUTES_TO_OPTIONS.dup # rubocop:disable Layout/LineLength end
Public Instance Methods
map(options:, system:)
click to toggle source
map populates an InSpec
options hash based on the intersection between the system keys and the supported options keys, converting keys from symbols to strings as required by InSpec
.
@param options [::Hash] the InSpec
options hash to be populated. @return [void]
# File lib/kitchen/pulumi/inspec_options_mapper.rb, line 45 def map(options:, system:) supported = system.lazy.select do |attribute_name, _| system_attributes_to_options.key?(attribute_name) end supported.each do |attribute_name, attribute_value| options.store( system_attributes_to_options.fetch(attribute_name), attribute_value, ) end options end