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.



175
176
177
178
# File 'lib/inspec/resources/nginx_conf.rb', line 175

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



193
194
195
196
197
# File 'lib/inspec/resources/nginx_conf.rb', line 193

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.



174
175
176
# File 'lib/inspec/resources/nginx_conf.rb', line 174

def params
  @params
end

#parentObject (readonly)

Returns the value of attribute parent.



174
175
176
# File 'lib/inspec/resources/nginx_conf.rb', line 174

def parent
  @parent
end

Instance Method Details

#locationsObject



184
185
186
# File 'lib/inspec/resources/nginx_conf.rb', line 184

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

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

Returns:

  • (Boolean)


199
200
201
202
203
# File 'lib/inspec/resources/nginx_conf.rb', line 199

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

  true
end

#to_sObject Also known as: inspect



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

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