Method: Inspec::ProfileContext#load_with_context
- Defined in:
- lib/inspec/profile_context.rb
#load_with_context(context, content, source = nil, line = nil) ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/inspec/profile_context.rb', line 149 def load_with_context(context, content, source = nil, line = nil) Inspec::Log.debug("Loading #{source || '<anonymous content>'} into #{self}") @current_load = { file: source } if content.is_a? Proc context.instance_eval(&content) elsif source.nil? && line.nil? context.instance_eval(content) else context.instance_eval(content, source || 'unknown', line || 1) end end |