Class: Inspec::Resources::NginxConf
- Inherits:
-
Object
- Object
- Inspec::Resources::NginxConf
- Extended by:
- Forwardable
- Includes:
- FindFiles
- Defined in:
- lib/resources/nginx_conf.rb
Constant Summary
Constants included from FindFiles
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
Instance Method Summary collapse
- #http ⇒ Object
-
#initialize(conf_path = nil) ⇒ NginxConf
constructor
A new instance of NginxConf.
- #params ⇒ Object
- #to_s ⇒ Object
Methods included from FindFiles
#find_files, #find_files_or_error
Constructor Details
#initialize(conf_path = nil) ⇒ NginxConf
Returns a new instance of NginxConf.
32 33 34 35 36 |
# File 'lib/resources/nginx_conf.rb', line 32 def initialize(conf_path = nil) @conf_path = conf_path || '/etc/nginx/nginx.conf' @contents = {} return skip_resource 'The `nginx_conf` resource is currently not supported on Windows.' if inspec.os.windows? end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
30 31 32 |
# File 'lib/resources/nginx_conf.rb', line 30 def contents @contents end |
Instance Method Details
#http ⇒ Object
45 46 47 |
# File 'lib/resources/nginx_conf.rb', line 45 def http NginxConfHttp.new(params['http'], self) end |
#params ⇒ Object
38 39 40 41 42 43 |
# File 'lib/resources/nginx_conf.rb', line 38 def params @params ||= parse_nginx(@conf_path) rescue StandardError => e skip_resource e. @params = {} end |
#to_s ⇒ Object
51 52 53 |
# File 'lib/resources/nginx_conf.rb', line 51 def to_s "nginx_conf #{@conf_path}" end |