Method: Inspec::Resources::WMI#initialize

Defined in:
lib/resources/wmi.rb

#initialize(wmiclass = nil, opts = nil) ⇒ WMI

Returns a new instance of WMI.



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/resources/wmi.rb', line 28

def initialize(wmiclass = nil, opts = nil)
  # verify that this resource is only supported on Windows
  return skip_resource 'The `windows_feature` resource is not supported on your OS.' unless inspec.os.windows?

  @options = opts || {}
  # if wmiclass is not a hash, we have to handle deprecation behavior
  if wmiclass.is_a?(Hash)
    @options.merge!(wmiclass)
  else
    warn '[DEPRECATION] `wmi(\'wmiclass\')` is deprecated.  Please use `wmi({class: \'wmiclass\'})` instead.'
    @options[:class] = wmiclass
  end
end