Method: Inspec::ProfileContext#initialize
- Defined in:
- lib/inspec/profile_context.rb
#initialize(profile_id, backend, conf) ⇒ ProfileContext
Returns a new instance of ProfileContext.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/inspec/profile_context.rb', line 23 def initialize(profile_id, backend, conf) if backend.nil? raise 'ProfileContext is initiated with a backend == nil. ' \ 'This is a backend error which must be fixed upstream.' end @profile_id = profile_id @backend = backend @conf = conf.dup @profile_name = @conf['profile'].profile_name || @profile_id if @conf['profile'] @skip_only_if_eval = @conf['check_mode'] @rules = {} @control_subcontexts = [] @lib_subcontexts = [] @require_loader = ::Inspec::RequireLoader.new Inspec::AttributeRegistry.register_profile_alias(@profile_id, @profile_name) if @profile_id != @profile_name @attributes = Inspec::AttributeRegistry.list_attributes_for_profile(@profile_id) # A local resource registry that only contains resources defined # in the transitive dependency tree of the loaded profile. @resource_registry = Inspec::Resource.new_registry @library_eval_context = Inspec::LibraryEvalContext.create(@resource_registry, @require_loader) @current_load = nil end |