Class: Inspec::Resources::NginxConfHttpEntry

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) ⇒ NginxConfHttpEntry

Returns a new instance of NginxConfHttpEntry.



179
180
181
182
# File 'lib/inspec/resources/nginx_conf.rb', line 179

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



197
198
199
200
201
# File 'lib/inspec/resources/nginx_conf.rb', line 197

def method_missing(name)
  return super if name.to_s.match?(/^to_/)

  (@params[name.to_s] || []).flatten
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



178
179
180
# File 'lib/inspec/resources/nginx_conf.rb', line 178

def params
  @params
end

#parentObject (readonly)

Returns the value of attribute parent.



178
179
180
# File 'lib/inspec/resources/nginx_conf.rb', line 178

def parent
  @parent
end

Instance Method Details

#locationsObject



188
189
190
# File 'lib/inspec/resources/nginx_conf.rb', line 188

def locations
  servers.map(&:locations).flatten
end

#respond_to_missing?(name, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


203
204
205
206
207
# File 'lib/inspec/resources/nginx_conf.rb', line 203

def respond_to_missing?(name, include_all = false)
  return super if name.to_s.match?(/^to_/)

  true
end

#to_sObject Also known as: inspect



192
193
194
# File 'lib/inspec/resources/nginx_conf.rb', line 192

def to_s
  @parent.to_s + ", http entry"
end