Clean up Inspec::Profile initialize to make it clear what options we use

This commit is contained in:
Steven Danna 2016-09-07 11:38:37 +01:00
parent e44a3802dd
commit f431794917
No known key found for this signature in database
GPG key ID: 94DFB46E861A7DAE

View file

@ -46,18 +46,18 @@ module Inspec
# rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/AbcSize
def initialize(source_reader, options = {}) def initialize(source_reader, options = {})
@options = options @target = options.delete(:target)
@target = @options.delete(:target) @logger = options[:logger] || Logger.new(nil)
@logger = @options[:logger] || Logger.new(nil) @locked_dependencies = options[:dependencies]
@source_reader = source_reader
if options[:dependencies]
@locked_dependencies = options[:dependencies]
end
@controls = options[:controls] || [] @controls = options[:controls] || []
@profile_id = @options[:id] @profile_id = options[:id]
@backend = @options[:backend] || Inspec::Backend.create(options) @backend = options[:backend] || Inspec::Backend.create(options)
@source_reader = source_reader
@tests_collected = false
Metadata.finalize(@source_reader.metadata, @profile_id) Metadata.finalize(@source_reader.metadata, @profile_id)
@runner_context = @options[:profile_context] || Inspec::ProfileContext.for_profile(self, @backend, @options[:attributes]) @runner_context = options[:profile_context] || Inspec::ProfileContext.for_profile(self,
@backend,
options[:attributes])
end end
def name def name