Class: Inspec::Resources::NginxConfServer
- Inherits:
-
Object
- Object
- Inspec::Resources::NginxConfServer
- Defined in:
- lib/inspec/resources/nginx_conf.rb
Overview
TODO: rename NginxServer
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(params, parent) ⇒ NginxConfServer
constructor
A new instance of NginxConfServer.
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(params, parent) ⇒ NginxConfServer
Returns a new instance of NginxConfServer.
187 188 189 190 |
# File 'lib/inspec/resources/nginx_conf.rb', line 187 def initialize(params, parent) @parent = parent @params = params || {} end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
186 187 188 |
# File 'lib/inspec/resources/nginx_conf.rb', line 186 def params @params end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
186 187 188 |
# File 'lib/inspec/resources/nginx_conf.rb', line 186 def parent @parent end |
Instance Method Details
#to_s ⇒ Object Also known as: inspect
196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/inspec/resources/nginx_conf.rb', line 196 def to_s server = "" name = Array(params["server_name"]).flatten.first unless name.nil? server += name listen = Array(params["listen"]).flatten.first server += ":#{listen}" unless listen.nil? end # go two levels up: 1. to the http entry and 2. to the root nginx conf @parent.parent.to_s + ", server #{server}" end |