class Inspec::Resources::NginxConfServer

Attributes

params[R]
parent[R]

Public Class Methods

new(params, parent) click to toggle source
# File lib/inspec/resources/nginx_conf.rb, line 214
def initialize(params, parent)
  @parent = parent
  @params = params || {}
end

Public Instance Methods

inspect()
Alias for: to_s
method_missing(name) click to toggle source
Calls superclass method
# File lib/inspec/resources/nginx_conf.rb, line 237
def method_missing(name)
  return super if name.to_s.match?(/^to_/)

  (@params[name.to_s] || []).flatten
end
respond_to_missing?(name, include_all = false) click to toggle source
Calls superclass method
# File lib/inspec/resources/nginx_conf.rb, line 243
def respond_to_missing?(name, include_all = false)
  return super if name.to_s.match?(/^to_/)

  true
end
to_s() click to toggle source
# File lib/inspec/resources/nginx_conf.rb, line 223
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
Also aliased as: inspect

Private Instance Methods

location_table() click to toggle source
# File lib/inspec/resources/nginx_conf.rb, line 251
def location_table
  @location_table ||= (params["location"] || []).map { |x| { "location" => NginxConfLocation.new(x, self) } }
end