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



38
39
40
41
42
43
44
45
46
# File 'lib/resources/security_policy.rb', line 38

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)
  res
end

Instance Method Details

#contentObject



28
29
30
# File 'lib/resources/security_policy.rb', line 28

def content
  read_content
end

#params(*opts) ⇒ Object



32
33
34
35
36
# File 'lib/resources/security_policy.rb', line 32

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

#to_sObject



48
49
50
# File 'lib/resources/security_policy.rb', line 48

def to_s
  'Security Policy'
end