Class: Inspec::Resources::SecurityPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/resources/security_policy.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/resources/security_policy.rb', line 89

def method_missing(name)
  params = read_params
  return nil if params.nil?

  # deep search for hash key
  params.extend Hashie::Extensions::DeepFind
  res = params.deep_find(name.to_s)

  # return an empty array if configuration does not include rights configuration
  return [] if res.nil? && MS_PRIVILEGES_RIGHTS.include?(name.to_s)
  res
end

Instance Method Details

#contentObject



79
80
81
# File 'lib/resources/security_policy.rb', line 79

def content
  read_content
end

#params(*opts) ⇒ Object



83
84
85
86
87
# File 'lib/resources/security_policy.rb', line 83

def params(*opts)
  opts.inject(read_params) do |res, nxt|
    res.respond_to?(:key) ? res[nxt] : nil
  end
end

#to_sObject



102
103
104
# File 'lib/resources/security_policy.rb', line 102

def to_s
  'Security Policy'
end