Class: Inspec::Resources::NginxConfLocation

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params, parent) ⇒ NginxConfLocation

Returns a new instance of NginxConfLocation.



258
259
260
261
# File 'lib/inspec/resources/nginx_conf.rb', line 258

def initialize(params, parent)
  @parent = parent
  @params = params || {}
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



257
258
259
# File 'lib/inspec/resources/nginx_conf.rb', line 257

def params
  @params
end

#parentObject (readonly)

Returns the value of attribute parent.



257
258
259
# File 'lib/inspec/resources/nginx_conf.rb', line 257

def parent
  @parent
end

Instance Method Details

#to_sObject Also known as: inspect



263
264
265
266
267
268
# File 'lib/inspec/resources/nginx_conf.rb', line 263

def to_s
  location = Array(params["_"]).join(" ")
  # go three levels up: 1. to the server entry, 2. http entry and 3. to the root nginx conf
  # TODO: fix parent.parent.parent
  @parent.parent.parent.to_s + ", location #{location.inspect}"
end