class Inspec::Resources::NginxConfServer

def initialize(params, parent)

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

def location_table

def location_table
  @location_table ||= (params['location'] || []).map { |x| { 'location' => NginxConfLocation.new(x, self) } }
end

def to_s

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